Commit 64500791f35248ca62fa4f150b8e1fd806fade99
1 parent
242338c5
Exists in
master
and in
1 other branch
coulda update
Showing
2 changed files
with
12 additions
and
9 deletions
Show diff stats
vendor/plugins/coulda/generators/feature/feature_generator.rb
... | ... | @@ -14,7 +14,7 @@ class FeatureGenerator < Rails::Generator::NamedBase |
14 | 14 | m.template 'step_definition.rb', path |
15 | 15 | |
16 | 16 | path = File.join('features', 'support', "paths.rb") |
17 | - m.insert_into path, insertable_path | |
17 | + m.insert_cucumber_path path, insertable_path | |
18 | 18 | end |
19 | 19 | end |
20 | 20 | ... | ... |
vendor/plugins/coulda/generators/support/insert_commands.rb
... | ... | @@ -10,14 +10,17 @@ Rails::Generator::Commands::Create.class_eval do |
10 | 10 | def insert_into(file, line) |
11 | 11 | logger.insert "#{line} into #{file}" |
12 | 12 | unless file_contains?(file, line) |
13 | - if file =~ /^module NavigationHelpers/ | |
14 | - gsub_file file, /#{Coulda::Insertable.cucumber_paths}/ do |match| | |
15 | - "#{match}\n#{line}" | |
16 | - end | |
17 | - else | |
18 | - gsub_file file, /^(class|module|#{Coulda::Insertable.routes}) .+$/ do |match| | |
19 | - "#{match}\n #{line}" | |
20 | - end | |
13 | + gsub_file file, /^(class|module|#{Coulda::Insertable.routes}) .+$/ do |match| | |
14 | + "#{match}\n #{line}" | |
15 | + end | |
16 | + end | |
17 | + end | |
18 | + | |
19 | + def insert_cucumber_path(file, line) | |
20 | + logger.insert "#{line} into #{file}" | |
21 | + unless file_contains?(file, line) | |
22 | + gsub_file file, /#{Coulda::Insertable.cucumber_paths}/ do |match| | |
23 | + "#{match}\n#{line}" | |
21 | 24 | end |
22 | 25 | end |
23 | 26 | end | ... | ... |