Class: AutoMock::Generators::AutoMockGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- AutoMock::Generators::AutoMockGenerator
- Defined in:
- lib/generators/auto_mock/auto_mock_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
11 12 13 |
# File 'lib/generators/auto_mock/auto_mock_generator.rb', line 11 def self.source_root @_auto_mock_source_root ||= File.(File.join(File.dirname(__FILE__), 'templates')) end |
Instance Method Details
#app_name ⇒ Object
26 27 28 |
# File 'lib/generators/auto_mock/auto_mock_generator.rb', line 26 def app_name Rails.application.class.name end |
#insert_include ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/generators/auto_mock/auto_mock_generator.rb', line 15 def insert_include spec_helper = 'spec/spec_helper.rb' if File.exists?(spec_helper) && File.readlines(spec_helper).grep(/include AutoMock::AutoMockHelper/).blank? File.open(spec_helper, 'a') do |f| f.puts 'include AutoMock::AutoMockHelper' end else raise Rails::Generators::Error, "First, you must setup rspec by 'rails generate rspec:install'" end end |