Class: Rspec::Generators::TMinusGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Rspec::Generators::TMinusGenerator
- Defined in:
- lib/generators/rspec/t_minus_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_view_file ⇒ Object
12 13 14 15 |
# File 'lib/generators/rspec/t_minus_generator.rb', line 12 def copy_view_file template 'view_spec.erb', "spec/views/prelaunch/new.html.#{[:template_engine]}_spec.rb" end |
#create_view_spec_directory ⇒ Object
8 9 10 |
# File 'lib/generators/rspec/t_minus_generator.rb', line 8 def create_view_spec_directory empty_directory 'spec/views/prelaunch' end |
#include_test_helper ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/generators/rspec/t_minus_generator.rb', line 17 def include_test_helper if File.exists? File.('spec/spec_helper.rb', @_source_root) append_file 'spec/spec_helper.rb', "require 't-minus/test_helper'" else create_file 'spec/spec_helper.rb', <<-FILE ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rspec/rails' Dir[Rails.root.join('spec/support/**/*.rb')].each {|f| require f} RSpec.configure do |config| config.mock_with :rspec config.fixture_path = "\#{::Rails.root}/spec/fixtures" config.use_transactional_fixtures = true end require 't-minus/test_helper' FILE end end |