PageRenderTime 17ms CodeModel.GetById 8ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/bundle/jruby/2.1/gems/rspec-core-2.14.8/features/configuration/backtrace_clean_patterns.feature

https://github.com/delowong/logstash
Gherkin Specification | 102 lines | 92 code | 10 blank | 0 comment | 0 complexity | fb81d6d9d343f5afd5cb12bac74bd292 MD5 | raw file
  1Feature: Backtrace cleaning
  2
  3  To aid in diagnozing spec failures, RSpec cleans matching lines from backtraces. The default patterns cleaned are:
  4
  5    /\/lib\d*\/ruby\//,
  6    /org\/jruby\//,
  7    /bin\//,
  8    /gems/,
  9    /spec\/spec_helper\.rb/,
 10    /lib\/rspec\/(core|expectations|matchers|mocks)/
 11
 12  This list can be modified or replaced with the `backtrace_clean_patterns` option. Additionally, rspec can be run with the `--backtrace` option to skip backtrace cleaning entirely.
 13
 14  Scenario: default configuration
 15    Given a file named "spec/failing_spec.rb" with:
 16    """ruby
 17    describe "2 + 2" do
 18      it "is 5" do
 19        (2+2).should eq(5)
 20      end
 21    end
 22    """
 23    When I run `rspec`
 24    Then the output should contain "1 example, 1 failure"
 25    And the output should not contain "lib/rspec/expectations"
 26
 27  Scenario: With a custom setting for backtrace_clean_patterns
 28    Given a file named "spec/spec_helper.rb" with:
 29    """ruby
 30    RSpec.configure do |config|
 31      config.backtrace_clean_patterns = [
 32        /spec_helper/
 33      ]
 34    end
 35
 36    def foo
 37      "bar"
 38    end
 39    """
 40    And a file named "spec/example_spec.rb" with:
 41    """ruby
 42    require 'spec_helper'
 43    describe "foo" do
 44      it "returns baz" do
 45        foo.should eq("baz")
 46      end
 47    end
 48    """
 49    When I run `rspec`
 50    Then the output should contain "1 example, 1 failure"
 51    And the output should contain "lib/rspec/expectations"
 52
 53  Scenario: Adding a pattern
 54    Given a file named "spec/matchers/be_baz_matcher.rb" with:
 55    """ruby
 56    RSpec::Matchers.define :be_baz do |_|
 57      match do |actual|
 58        actual == "baz"
 59      end
 60    end
 61    """
 62    And a file named "spec/example_spec.rb" with:
 63    """ruby
 64    RSpec.configure do |config|
 65      config.backtrace_clean_patterns << /be_baz_matcher/
 66    end
 67
 68    describe "bar" do
 69      it "is baz" do
 70        "bar".should be_baz
 71      end
 72    end
 73    """
 74    When I run `rspec`
 75    Then the output should contain "1 example, 1 failure"
 76    But the output should not contain "be_baz_matcher"
 77    And the output should not contain "lib/rspec/expectations"
 78
 79  Scenario: Running with the --backtrace option
 80    Given a file named "spec/matchers/be_baz_matcher.rb" with:
 81    """ruby
 82    RSpec::Matchers.define :be_baz do |_|
 83      match do |actual|
 84        actual == "baz"
 85      end
 86    end
 87    """
 88    And a file named "spec/example_spec.rb" with:
 89    """ruby
 90    RSpec.configure do |config|
 91      config.backtrace_clean_patterns << /be_baz_matcher/
 92    end
 93
 94    describe "bar" do
 95      it "is baz" do
 96        "bar".should be_baz
 97      end
 98    end
 99    """
100    When I run `rspec --backtrace`
101    Then the output should contain "1 example, 1 failure"
102    And the output should not contain "be_baz_matcher"