Contents

Showing the backtrace

RSpec cleans the backtrace when an example fails. You can configure RSpec to include all backtrace information if you need to do some troubleshooting.

Scenario: Show entire backtrace

  • Given a ticket named "tickets/consumer-provider.json" including the following interaction:
    json
    {
      "label": "greeting",
      "request": {
        "type": "hash",
        "value": {
          "path": {
            "type": "string",
            "value": "/greeting"
          },
          "method": {
            "type": "string",
            "value": "get"
          }
        }
      },
      "response": {
        "type": "hash",
        "value": {
          "status": {
            "type": "number",
            "value": 200
          },
          "body": {
            "type": "json_paths",
            "value": {
              "$.message" : {
                "type": "regexp",
                "value": "hi"
              }
            }
          }
        }
      }
    }
  • And a file named "spec/provider.spec" with:
    ruby
    provider = lambda do |env|
      [200, {}, ['']]
    end
    
    Shokkenki.provider.configure do
      provider :provider { run provider }
    end
    
    Shokkenki.provider.redeem_tickets
  • When I run `rspec --backtrace spec/provider_spec.rb`
  • Then the output should contain "rspec-core"

Source: features/troubleshooting/showing_the_backtrace.feature at commit e6e14680, Shokkenki Provider (GPL license).