Skip to content

Commit

Permalink
test + tweak test cmd errors, disable untestable test
Browse files Browse the repository at this point in the history
  • Loading branch information
cldwalker committed Mar 1, 2011
1 parent c4799e3 commit 9a32803
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions features/basics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ Feature: options, help and misc edge cases
And the exit status should be 1

Scenario: Print error for unexpected error
When I run "one9 test zzz"
When I run an invalid command
Then the stderr should contain "one9 error:"
And the stderr should contain "zzz"
And the stderr should contain "moooo"
10 changes: 10 additions & 0 deletions features/commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ Feature: Commands
Then the output should contain "** One9 Report **"
And the output should not contain multiple reports

Scenario: test command prints error when saving fails
Given I am unable to save my test
When I run "one9 test ruby -e 'puts'"
Then the stderr should contain "one9: Error while saving report"

Scenario: test command with invalid Rakefile prints errors
Given an empty file named "Rakefile"
When I run "one9 test"
Then the stderr should contain "** one9: Error occurred while testing **"

Scenario: changes command with rc file
Given I have a rc file
When I run "one9 changes"
Expand Down
4 changes: 4 additions & 0 deletions features/step_definitions/one9_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
File.open(One9::Report.marshal_file, 'wb') {|f| f.write Marshal.dump([{}, {}]) }
end

Given /^I am unable to save my test$/ do
FileUtils.rm_rf One9.dir
end

Given /^I have the editor "([^"]*)"$/ do |editor|
ENV['EDITOR'] = editor
end
Expand Down
2 changes: 1 addition & 1 deletion lib/one9/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def quickfix(*args)
end

def print(meths, stacks)
FileUtils.touch lock_file
FileUtils.touch lock_file if File.exists? One9.dir
Hirb.enable
results = ReportMethod.create(meths, stacks)
results = results.select {|e| e.count > 0 }
Expand Down
3 changes: 2 additions & 1 deletion lib/one9/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def run(argv=ARGV)
def test(*args)
command_help(:test, *args)
ENV['RUBYOPT'] = '-rone9/it'
exec args.empty? ? 'rake test' : args.join(' ')
system args.empty? ? 'rake test' : args.join(' ')
warn "** one9: Error occurred while testing **" unless $?.success?
end

def edit(query=nil)
Expand Down

0 comments on commit 9a32803

Please sign in to comment.