Class: PickleGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PickleGenerator
- Defined in:
- lib/generators/pickle_generator.rb
Instance Method Summary collapse
- #copy_email_steps_file ⇒ Object
- #copy_paths_file ⇒ Object
- #copy_pickle_steps_file ⇒ Object
- #create_directories ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ PickleGenerator
constructor
A new instance of PickleGenerator.
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ PickleGenerator
Returns a new instance of PickleGenerator.
12 13 14 15 16 17 18 19 |
# File 'lib/generators/pickle_generator.rb', line 12 def initialize(args = [], = {}, config = {}) super if self..paths? && !File.exists?("features/support/paths.rb") say "features/support/paths.rb not found, is your cucumber up to date?", :red exit end end |
Instance Method Details
#copy_email_steps_file ⇒ Object
44 45 46 47 48 |
# File 'lib/generators/pickle_generator.rb', line 44 def copy_email_steps_file return unless .email? template "email_steps.rb", "features/step_definitions/email_steps.rb" template "email.rb", "features/support/email.rb" end |
#copy_paths_file ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/generators/pickle_generator.rb', line 31 def copy_paths_file return unless .paths? current_paths = File.read("features/support/paths.rb") unless current_paths.include?('#{capture_model}') if current_paths =~ /^(.*)(\n\s+else\n\s+raise "Can't find.*".*$)/m @current_paths_header = $1 @current_paths_footer = $2 end template "paths.rb", "features/support/paths.rb" end end |
#copy_pickle_steps_file ⇒ Object
26 27 28 29 |
# File 'lib/generators/pickle_generator.rb', line 26 def copy_pickle_steps_file template "pickle_steps.rb", "features/step_definitions/pickle_steps.rb" template "pickle.rb", "features/support/pickle.rb" end |
#create_directories ⇒ Object
21 22 23 24 |
# File 'lib/generators/pickle_generator.rb', line 21 def create_directories empty_directory "features/step_definitions" empty_directory "features/support" end |