Class: Suspenders::TestingGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Suspenders::TestingGenerator
- Defined in:
- lib/suspenders/generators/testing_generator.rb
Instance Method Summary collapse
- #add_helpers_for_rspec ⇒ Object
- #add_testing_gems ⇒ Object
- #configure_action_mailer_in_specs ⇒ Object
- #configure_i18n_for_test_environment ⇒ Object
- #configure_rspec ⇒ Object
- #configure_spec_support_features ⇒ Object
- #create_binstubs ⇒ Object
- #generate_rspec ⇒ Object
- #provide_shoulda_matchers_config ⇒ Object
Instance Method Details
#add_helpers_for_rspec ⇒ Object
51 52 53 |
# File 'lib/suspenders/generators/testing_generator.rb', line 51 def add_helpers_for_rspec copy_file 'queries_helper_rspec.rb', 'spec/support/queries_helper.rb' end |
#add_testing_gems ⇒ Object
10 11 12 13 14 15 |
# File 'lib/suspenders/generators/testing_generator.rb', line 10 def add_testing_gems gem "rspec-rails", "~> 3.8", group: %i(development test) gem "shoulda-matchers", group: :test Bundler.with_clean_env { run "bundle install" } end |
#configure_action_mailer_in_specs ⇒ Object
43 44 45 |
# File 'lib/suspenders/generators/testing_generator.rb', line 43 def configure_action_mailer_in_specs copy_file "action_mailer.rb", "spec/support/action_mailer.rb" end |
#configure_i18n_for_test_environment ⇒ Object
39 40 41 |
# File 'lib/suspenders/generators/testing_generator.rb', line 39 def configure_i18n_for_test_environment copy_file "i18n.rb", "spec/support/i18n.rb" end |
#configure_rspec ⇒ Object
21 22 23 24 25 26 |
# File 'lib/suspenders/generators/testing_generator.rb', line 21 def configure_rspec remove_file "spec/rails_helper.rb" remove_file "spec/spec_helper.rb" copy_file "rails_helper.rb", "spec/rails_helper.rb" copy_file "spec_helper.rb", "spec/spec_helper.rb" end |
#configure_spec_support_features ⇒ Object
35 36 37 |
# File 'lib/suspenders/generators/testing_generator.rb', line 35 def configure_spec_support_features empty_directory_with_keep_file "spec/system" end |
#create_binstubs ⇒ Object
47 48 49 |
# File 'lib/suspenders/generators/testing_generator.rb', line 47 def create_binstubs Bundler.with_clean_env { run "bundle binstubs rspec-core" } end |
#generate_rspec ⇒ Object
17 18 19 |
# File 'lib/suspenders/generators/testing_generator.rb', line 17 def generate_rspec generate "rspec:install" end |
#provide_shoulda_matchers_config ⇒ Object
28 29 30 31 32 33 |
# File 'lib/suspenders/generators/testing_generator.rb', line 28 def provide_shoulda_matchers_config copy_file( "shoulda_matchers_config_rspec.rb", "spec/support/shoulda_matchers.rb", ) end |