From 64500791f35248ca62fa4f150b8e1fd806fade99 Mon Sep 17 00:00:00 2001 From: Dan Croak Date: Sat, 11 Jul 2009 14:29:33 -0400 Subject: [PATCH] coulda update --- vendor/plugins/coulda/generators/feature/feature_generator.rb | 2 +- vendor/plugins/coulda/generators/support/insert_commands.rb | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/vendor/plugins/coulda/generators/feature/feature_generator.rb b/vendor/plugins/coulda/generators/feature/feature_generator.rb index 9bb0ccb..785f18b 100644 --- a/vendor/plugins/coulda/generators/feature/feature_generator.rb +++ b/vendor/plugins/coulda/generators/feature/feature_generator.rb @@ -14,7 +14,7 @@ class FeatureGenerator < Rails::Generator::NamedBase m.template 'step_definition.rb', path path = File.join('features', 'support', "paths.rb") - m.insert_into path, insertable_path + m.insert_cucumber_path path, insertable_path end end diff --git a/vendor/plugins/coulda/generators/support/insert_commands.rb b/vendor/plugins/coulda/generators/support/insert_commands.rb index 4744a62..753c763 100644 --- a/vendor/plugins/coulda/generators/support/insert_commands.rb +++ b/vendor/plugins/coulda/generators/support/insert_commands.rb @@ -10,14 +10,17 @@ Rails::Generator::Commands::Create.class_eval do def insert_into(file, line) logger.insert "#{line} into #{file}" unless file_contains?(file, line) - if file =~ /^module NavigationHelpers/ - gsub_file file, /#{Coulda::Insertable.cucumber_paths}/ do |match| - "#{match}\n#{line}" - end - else - gsub_file file, /^(class|module|#{Coulda::Insertable.routes}) .+$/ do |match| - "#{match}\n #{line}" - end + gsub_file file, /^(class|module|#{Coulda::Insertable.routes}) .+$/ do |match| + "#{match}\n #{line}" + end + end + end + + def insert_cucumber_path(file, line) + logger.insert "#{line} into #{file}" + unless file_contains?(file, line) + gsub_file file, /#{Coulda::Insertable.cucumber_paths}/ do |match| + "#{match}\n#{line}" end end end -- libgit2 0.21.2