class Suspenders::TestingGenerator
Public Instance Methods
add_helpers_for_rspec()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 47 def add_helpers_for_rspec copy_file 'queries_helper_rspec.rb', 'spec/support/queries_helper.rb' end
add_testing_gems()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 5 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()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 39 def configure_action_mailer_in_specs copy_file "action_mailer.rb", "spec/support/action_mailer.rb" end
configure_i18n_for_test_environment()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 35 def configure_i18n_for_test_environment copy_file "i18n.rb", "spec/support/i18n.rb" end
configure_rspec()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 16 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_system_tests()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 30 def configure_system_tests empty_directory_with_keep_file "spec/system" empty_directory_with_keep_file "spec/support/system" end
create_binstubs()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 43 def create_binstubs Bundler.with_clean_env { run "bundle binstubs rspec-core" } end
generate_rspec()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 12 def generate_rspec generate "rspec:install" end
provide_shoulda_matchers_config()
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 23 def provide_shoulda_matchers_config copy_file( "shoulda_matchers_config_rspec.rb", "spec/support/shoulda_matchers.rb", ) end
Private Instance Methods
empty_directory_with_keep_file(destination)
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 53 def empty_directory_with_keep_file(destination) empty_directory(destination, {}) keep_file(destination) end
keep_file(destination)
click to toggle source
# File lib/suspenders/generators/testing_generator.rb, line 58 def keep_file(destination) create_file(File.join(destination, ".keep")) end