Skip to content

Commit

Permalink
Get rid of that stupid --wip stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Feb 24, 2010
1 parent f0c491a commit 49c1c3a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
14 changes: 3 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@ end
begin
require 'cucumber/rake/task'

namespace :cucumber do
Cucumber::Rake::Task.new(:pass) do |t|
t.cucumber_opts = %w{--tags ~@fail}
t.cucumber_opts += %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
end

Cucumber::Rake::Task.new(:fail) do |t|
t.cucumber_opts = %w{--tags @fail --wip}
t.cucumber_opts += %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
end
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
end

task :cucumber => [:check_dependencies, 'cucumber:pass', 'cucumber:fail']
task :cucumber => :check_dependencies
rescue LoadError
task :cucumber do
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
Expand Down
7 changes: 3 additions & 4 deletions features/file_system_commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ Feature: file system commands
When I run "ruby example.rb"
Then the exit status should be 1

@fail
Scenario: Holler if cd to bad dir
Given a file named "foo/bar/example.rb" with:
"""
puts "hello world"
"""
When I cd to "foo/nonexistant"
When I do aruba I cd to "foo/nonexistant"
Then aruba should fail with "tmp/aruba/foo/nonexistant is not a directory"

Scenario: Check for presence of a subset of files
Given an empty file named "lorem/ipsum/dolor"
Expand All @@ -64,7 +64,6 @@ Feature: file system commands
| lorem/ipsum/dolor |
| lorem/ipsum/amet |

@fail
Scenario: Check for presence of a subset of files
Then the following files should exist:
Then the following files should not exist:
| lorem/ipsum/dolor |
12 changes: 12 additions & 0 deletions features/support/step_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
File.open(filename, 'w') {|io| io.write(content)}
end

When /^I do aruba (.*)$/ do |aruba_step|
begin
When(aruba_step)
rescue => e
@aruba_exception = e
end
end

Then /^I should see the JRuby version$/ do
Then %{I should see "#{JRUBY_VERSION}"}
end

Then /^aruba should fail with "([^\"]*)"$/ do |error_message|
@aruba_exception.message.should =~ compile_and_escape(error_message)
end
10 changes: 8 additions & 2 deletions lib/aruba/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ def create_dir(dir_name)
end
end

def check_file_presence(paths)
def check_file_presence(paths, expect_presence)
in_current_dir do
paths.each{|path| File.should be_file(path)}
paths.each do |path|
if expect_presence
File.should be_file(path)
else
File.should_not be_file(path)
end
end
end
end

Expand Down
6 changes: 5 additions & 1 deletion lib/aruba/cucumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,9 @@
end

Then /^the following files should exist:$/ do |files|
check_file_presence(files.raw.map{|file_row| file_row[0]})
check_file_presence(files.raw.map{|file_row| file_row[0]}, true)
end

Then /^the following files should not exist:$/ do |files|
check_file_presence(files.raw.map{|file_row| file_row[0]}, false)
end

0 comments on commit 49c1c3a

Please sign in to comment.