File tree Expand file tree Collapse file tree
generators/graphql_devise Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ # This command will automatically be run when you run "rails" with Rails gems
3+ # installed from the root of your application.
4+
5+ APP_PATH = File . expand_path ( '../../../../spec/dummy/config/application' , __dir__ )
6+
7+ require 'rails/all'
Original file line number Diff line number Diff line change 33require 'generators/graphql_devise/install_generator'
44
55RSpec . describe GraphqlDevise ::InstallGenerator , type : :generator do
6- destination File . expand_path ( '../../../tmp' , __FILE__ )
6+ destination File . expand_path ( '../../../tmp/dummy ' , __dir__ )
77
88 before do
99 prepare_destination
10+ copy_rails_bin
1011 end
1112
1213 let ( :routes_path ) { "#{ destination_root } /config/routes.rb" }
1314 let ( :routes_content ) { File . read ( routes_path ) }
1415 let ( :dta_route ) { "mount_devise_token_auth_for 'User', at: 'auth'" }
1516
16- xcontext 'when the file exists' do
17+ context 'when the file exists' do
1718 before do
1819 create_file_with_content (
1920 routes_path ,
4243 end
4344 end
4445
45- xcontext 'when file does *NOT* exist' do
46+ context 'when file does *NOT* exist' do
4647 before { run_generator }
4748
4849 it 'does *NOT* create the file and throw no exception' do
49- expect ( File . exist? ( routes_path ) ) . to be_falsey
50+ expect ( File ) . not_to exist ( routes_path )
5051 end
5152 end
53+
54+ def copy_rails_bin
55+ FileUtils . mkdir_p ( File . join ( destination_root , 'bin' ) )
56+ FileUtils . copy_file ( 'spec/fixtures/rails' , File . join ( destination_root , 'bin/rails' ) )
57+ end
5258end
Original file line number Diff line number Diff line change 44
55 SimpleCov . formatter = Coveralls ::SimpleCov ::Formatter
66 SimpleCov . start 'rails' do
7- add_filter [ 'spec' , 'lib/generators' ]
7+ add_filter [ 'spec' ]
88 end
99end
1010
You can’t perform that action at this time.
0 commit comments