Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,85 +100,6 @@ Failures:
# ./spec/use_block_form_spec.rb:12
```

## Use `aggregate_failures` block form

_Given_ a file named "spec/use_block_form_spec.rb" with:

```ruby
require 'client'

RSpec.describe Client do
after do
# this should be appended to failure list
expect(false).to be(true), "after hook failure"
end

around do |ex|
ex.run
# this should also be appended to failure list
expect(false).to be(true), "around hook failure"
end

it "returns a successful response" do
response = Client.make_request

aggregate_failures "testing response" do
expect(response.status).to eq(200)
expect(response.headers).to include("Content-Type" => "application/json")
expect(response.body).to eq('{"message":"Success"}')
end
end
end
```

_When_ I run `rspec spec/use_block_form_spec.rb`

_Then_ it should fail and list all the failures:

```
Failures:

1) Client returns a successful response
Got 3 failures:

1.1) Got 3 failures from failure aggregation block "testing response".
# ./spec/use_block_form_spec.rb:18
# ./spec/use_block_form_spec.rb:10

1.1.1) Failure/Error: expect(response.status).to eq(200)

expected: 200
got: 404

(compared using ==)
# ./spec/use_block_form_spec.rb:19

1.1.2) Failure/Error: expect(response.headers).to include("Content-Type" => "application/json")
expected {"Content-Type" => "text/plain"} to include {"Content-Type" => "application/json"}
Diff:
@@ -1,2 +1,2 @@
-"Content-Type" => "application/json",
+"Content-Type" => "text/plain",
# ./spec/use_block_form_spec.rb:20

1.1.3) Failure/Error: expect(response.body).to eq('{"message":"Success"}')

expected: "{\"message\":\"Success\"}"
got: "Not Found"

(compared using ==)
# ./spec/use_block_form_spec.rb:21

1.2) Failure/Error: expect(false).to be(true), "after hook failure"
after hook failure
# ./spec/use_block_form_spec.rb:6
# ./spec/use_block_form_spec.rb:10

1.3) Failure/Error: expect(false).to be(true), "around hook failure"
around hook failure
# ./spec/use_block_form_spec.rb:12
```

## Use `:aggregate_failures` metadata

_Given_ a file named "spec/use_metadata_spec.rb" with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,85 +100,6 @@ Failures:
# ./spec/use_block_form_spec.rb:12
```

## Use `aggregate_failures` block form

_Given_ a file named "spec/use_block_form_spec.rb" with:

```ruby
require 'client'

RSpec.describe Client do
after do
# this should be appended to failure list
expect(false).to be(true), "after hook failure"
end

around do |ex|
ex.run
# this should also be appended to failure list
expect(false).to be(true), "around hook failure"
end

it "returns a successful response" do
response = Client.make_request

aggregate_failures "testing response" do
expect(response.status).to eq(200)
expect(response.headers).to include("Content-Type" => "application/json")
expect(response.body).to eq('{"message":"Success"}')
end
end
end
```

_When_ I run `rspec spec/use_block_form_spec.rb`

_Then_ it should fail and list all the failures:

```
Failures:

1) Client returns a successful response
Got 3 failures:

1.1) Got 3 failures from failure aggregation block "testing response".
# ./spec/use_block_form_spec.rb:18
# ./spec/use_block_form_spec.rb:10

1.1.1) Failure/Error: expect(response.status).to eq(200)

expected: 200
got: 404

(compared using ==)
# ./spec/use_block_form_spec.rb:19

1.1.2) Failure/Error: expect(response.headers).to include("Content-Type" => "application/json")
expected {"Content-Type" => "text/plain"} to include {"Content-Type" => "application/json"}
Diff:
@@ -1,2 +1,2 @@
-"Content-Type" => "application/json",
+"Content-Type" => "text/plain",
# ./spec/use_block_form_spec.rb:20

1.1.3) Failure/Error: expect(response.body).to eq('{"message":"Success"}')

expected: "{\"message\":\"Success\"}"
got: "Not Found"

(compared using ==)
# ./spec/use_block_form_spec.rb:21

1.2) Failure/Error: expect(false).to be(true), "after hook failure"
after hook failure
# ./spec/use_block_form_spec.rb:6
# ./spec/use_block_form_spec.rb:10

1.3) Failure/Error: expect(false).to be(true), "around hook failure"
around hook failure
# ./spec/use_block_form_spec.rb:12
```

## Use `:aggregate_failures` metadata

_Given_ a file named "spec/use_metadata_spec.rb" with:
Expand Down
Loading