Permalink
Browse files

Address cucumber tasks being included when appropriate.

  • Loading branch information...
1 parent c408712 commit 93d29b2f438b5eec3c95578166a50bab48fef30c @technicalpickles committed Feb 21, 2009
@@ -55,3 +55,19 @@ Feature: generated Rakefile
Then Rakefile has 'test/**/*_test.rb' for the Rake::TestTask pattern
And Rakefile has 'test/**/*_test.rb' for the Rcov::RcovTask pattern
And Rakefile has 'test' in the Rcov::RcovTask libs
+
+ Scenario: no cucumber
+ Given a working directory
+ And I have configured git sanely
+ And I do not want cucumber stories
+ When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
+ Then Rakefile does not require 'cucumber/rake/task'
+ And Rakefile does not instantiate a Cucumber::Rake::Task
+
+ Scenario: cucumber
+ Given a working directory
+ And I have configured git sanely
+ And I want cucumber stories
+ When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
+ Then Rakefile requires 'cucumber/rake/task'
+ And Rakefile instantiates a Cucumber::Rake::Task
@@ -144,9 +144,36 @@
Then /^'(.*)' requires '(.*)'$/ do |file, lib|
content = File.read(File.join(@working_dir, @name, file))
- assert_match /require ['"]#{lib}['"]/, content
+ assert_match /require ['"]#{Regexp.escape(lib)}['"]/, content
end
+Then /^'(.*)' does not require '(.*)'$/ do |file, lib|
+ content = File.read(File.join(@working_dir, @name, file))
+
+ assert_no_match /require ['"]#{Regexp.escape(lib)}['"]/, content
+end
+
+Then /^Rakefile does not require 'cucumber\/rake\/task'$/ do
+ Then "'Rakefile' does not require 'cucumber/rake/task'"
+end
+
+Then /^Rakefile requires 'cucumber\/rake\/task'$/ do
+ Then "'Rakefile' requires 'cucumber/rake/task'"
+end
+
+Then /^Rakefile does not instantiate a Cucumber::Rake::Task$/ do
+ content = File.read(File.join(@working_dir, @name, 'Rakefile'))
+ assert_no_match /Cucumber::Rake::Task.new/, content
+end
+
+Then /^Rakefile instantiates a Cucumber::Rake::Task$/ do
+ content = File.read(File.join(@working_dir, @name, 'Rakefile'))
+ assert_match /Cucumber::Rake::Task.new/, content
+end
+
+
+
+
Then /^'test\/test_helper\.rb' should autorun tests$/ do
content = File.read(File.join(@working_dir, @name, 'test/test_helper.rb'))
@@ -59,6 +59,7 @@ rescue LoadError
end
<% end %>
+<% if should_use_cucumber %>
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features)
@@ -68,6 +69,7 @@ rescue LoadError
end
end
+<% end %>
<% if testing_framework.to_sym == :rspec %>
task :default => :spec
<% else %>

0 comments on commit 93d29b2

Please sign in to comment.