Skip to content

Commit

Permalink
Add some regression tests for some popular custom formatter gems.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Feb 10, 2014
1 parent f184fa6 commit 2b2468e
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cucumber.yml
Expand Up @@ -3,4 +3,4 @@ exclusions = []
exclusions << ' --tags ~@no-jruby' if RUBY_PLATFORM == 'java'
%>
default: --require features --strict --format progress --tags ~@wip<%= exclusions.join %> features
wip: --require features --tags @wip:3 --wip features
wip: --require features --tags @wip:30 --wip features
80 changes: 80 additions & 0 deletions features/formatters/regression_tests.feature
@@ -0,0 +1,80 @@
Feature: Regression tests for legacy custom formatters

Background:
Given a file named "spec/passing_and_failing_spec.rb" with:
"""ruby
RSpec.describe "Some examples" do
it "passes" do
expect(1).to eq(1)
end
it "fails" do
expect(1).to eq(2)
end
context "nested" do
it "passes" do
expect(1).to eq(1)
end
it "fails" do
expect(1).to eq(2)
end
end
end
"""
And a file named "spec/pending_spec.rb" with:
"""ruby
RSpec.describe "Some pending examples" do
context "pending" do
it "is reported as pending" do
pending { expect(1).to eq(2) }
end
it "is reported as failing" do
pending { expect(1).to eq(1) }
end
end
end
"""

@wip @announce
Scenario: Use fuubar formatter
When I run `rspec --format Fuubar`
Then the output should contain "Progress: |============"
And the output should contain "6 examples, 3 failures, 1 pending"
And the output should contain "The Fuubar formatter uses the deprecated formatter interface"
But the output should not contain any error backtraces

Scenario: Use rspec-instafail formatter
When I run `rspec --format RSpec::Instafail`
Then the output should contain "6 examples, 3 failures, 1 pending"
And the output should contain "The RSpec::Instafail formatter uses the deprecated formatter interface"
But the output should not contain any error backtraces

Scenario: Use rspec-extra-formatters JUnit formatter
When I run `rspec --require rspec-extra-formatters --format JUnitFormatter`
Then the output should contain:
"""
<testsuite errors="0" failures="3" skipped="1" tests="6"
"""
And the output should contain "The JUnitFormatter formatter uses the deprecated formatter interface"
But the output should not contain any error backtraces

@wip @announce
Scenario: Use rspec-extra-formatters Tap formatter
When I run `rspec --require rspec-extra-formatters --format TapFormatter`
Then the output should contain "TAP version 13"
And the output should contain "The TapFormatter formatter uses the deprecated formatter interface"
But the output should not contain any error backtraces

@wip @announce
Scenario: Use rspec-spinner formatter
When I run `rspec --require rspec_spinner --format RspecSpinner::Spinner`
Then the output should contain "TBD"

@wip @announce
Scenario: Use nyancat formatter
When I run `rspec --format NyanCatFormatter`
Then the output should contain "TBD"

4 changes: 4 additions & 0 deletions features/step_definitions/additional_cli_steps.rb
Expand Up @@ -41,6 +41,10 @@
expect(normalized_output).to match(regexp(partial_output))
end

Then /^the output should not contain any error backtraces$/ do
step %q{the output should not contain "lib/rspec/core"}
end

# This step can be generalized if it's ever used to test other colors
Then /^the failing example is printed in magenta$/ do
# \e[35m = enable magenta
Expand Down
8 changes: 7 additions & 1 deletion rspec-core.gemspec
Expand Up @@ -46,8 +46,14 @@ Gem::Specification.new do |s|
s.add_development_dependency "nokogiri", "1.5.2"
s.add_development_dependency "coderay", "~> 1.0.9"


s.add_development_dependency "mocha", "~> 0.13.0"
s.add_development_dependency "rr", "~> 1.0.4"
s.add_development_dependency "flexmock", "~> 0.9.0"

# For legacy custom formatter regression tests
s.add_development_dependency "fuubar", "1.3.2"
s.add_development_dependency "nyan-cat-formatter", "0.5.2"
s.add_development_dependency "rspec-instafail", "0.2.4"
s.add_development_dependency "rspec_spinner", "2.0.0"
s.add_development_dependency "rspec-extra-formatters", "1.0.0"
end

0 comments on commit 2b2468e

Please sign in to comment.