Autotest regexp patch #288

Closed
wants to merge 5 commits into
from
View
@@ -1,3 +1,4 @@
+.rvmrc
*.sw?
.DS_Store
coverage*
@@ -10,7 +10,7 @@
end
end
-Then /^the example(s)? should( all)? pass$/ do |*|
+Then /^the example(?:s)? should(?: all)? pass$/ do
Then %q{the output should contain "0 failures"}
Then %q{the exit status should be 0}
end
@@ -19,7 +19,7 @@ def initialize
# Example for Ruby 1.8: http://rubular.com/r/AOXNVDrZpx
# Example for Ruby 1.9: http://rubular.com/r/85ag5AZ2jP
- self.failed_results_re = /^\s*\d+\).*\n\s+Failure.*(\n\s+#\s(.*)?:\d+(?::.*)?)+$/m
+ self.failed_results_re = /^\s*\d+\).*\n\s+(?:\e\[\d*m)?Failure.*(\n(?:\e\[\d*m)?\s+#\s(.*)?:\d+(?::.*)?(?:\e\[\d*m)?)+$/m
self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
end
@@ -7,14 +7,31 @@
group = RSpec::Core::ExampleGroup.describe("group name")
group.example("example name") { "this".should eq("that") }
group.run(formatter)
- RSpec.configuration.stub(:color_enabled?) { false }
formatter.dump_failures
output.string
end
- it "matches a failure" do
- re = Autotest::Rspec2.new.failed_results_re
- example_output.should =~ re
- example_output[re, 2].should == __FILE__.sub(File.expand_path('.'),'.')
+ context "output does not have color enabled" do
+ before do
+ RSpec.configuration.stub(:color_enabled?) { false }
+ end
+
+ it "matches a failure" do
+ re = Autotest::Rspec2.new.failed_results_re
+ example_output.should =~ re
+ example_output[re, 2].should == __FILE__.sub(File.expand_path('.'),'.')
+ end
+ end
+
+ context "output has color enabled" do
+ before do
+ RSpec.configuration.stub(:color_enabled?) { true }
+ end
+
+ it "matches a failure" do
+ re = Autotest::Rspec2.new.failed_results_re
+ example_output.should =~ re
+ example_output[re, 2].should == __FILE__.sub(File.expand_path('.'),'.')
+ end
end
end