Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated autotest regular expression and consolidate failures to work …
…directly from text formatter - Closes #97.
- Loading branch information
1 parent
1d57042
commit 6f6ea21
Showing
3 changed files
with
18 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,22 @@ | ||
require "spec_helper" | ||
|
||
describe "failed_results_re for autotest" do | ||
it "should match a failure" do | ||
re = Autotest::Rspec2.new.failed_results_re | ||
re =~ "1)\n'this example' FAILED\nreason\n/path.rb:37:\n\n" | ||
$1.should == "this example" | ||
$2.should == "reason\n/path.rb:37:" | ||
end | ||
|
||
it "should match a failure when matcher outputs multiple lines" do | ||
re = Autotest::Rspec2.new.failed_results_re | ||
re =~ "1)\n'other example' FAILED\n\nreason line 1\nreason line 2\n\n(additional info)\n/path.rb:37:\n\n" | ||
$1.should == "other example" | ||
$2.should == "reason line 1\nreason line 2\n\n(additional info)\n/path.rb:37:" | ||
let(:output) { StringIO.new } | ||
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) } | ||
let(:example_output) do | ||
group = RSpec::Core::ExampleGroup.describe("group name") | ||
example = group.example("example name") { "this".should eq("that") } | ||
group.run_all(formatter) | ||
RSpec.configuration.stub(:color_enabled?) { false } | ||
formatter.dump_failures | ||
output.string | ||
end | ||
|
||
it "should match an Error" do | ||
it "should match a failure" do | ||
re = Autotest::Rspec2.new.failed_results_re | ||
re =~ "1)\nRuntimeError in 'this example'\nreason\n/path.rb:37:\n\n" | ||
$1.should == "this example" | ||
$2.should == "reason\n/path.rb:37:" | ||
re =~ example_output | ||
$1.should == "group name example name\n Failure/Error: example = group.example(\"example name\") { \"this\".should eq(\"that\") }" | ||
$2.should == "./spec/autotest/failed_results_re_spec.rb" | ||
end | ||
|
||
it "should match an Error that doesn't end in Error" do | ||
re = Autotest::Rspec2.new.failed_results_re | ||
re =~ "1)\nInvalidArgument in 'this example'\nreason\n/path.rb:37:\n\n" | ||
$1.should == "this example" | ||
$2.should == "reason\n/path.rb:37:" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters