Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Mar 18, 2024
1 parent 21ab125 commit 8412627
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
rspec-expectations is used to define expected outcomes.

```ruby
RSpec.describe Account do
it "has a balance of zero when first created" do
expect(Account.new.balance).to eq(Money.new(0))
end
end
RSpec.describe Account do
it "has a balance of zero when first created" do
expect(Account.new.balance).to eq(Money.new(0))
end
end
```

## Basic structure

The basic structure of an rspec expectation is:

```ruby
expect(actual).to matcher(expected)
expect(actual).not_to matcher(expected)
expect(actual).to matcher(expected)
expect(actual).not_to matcher(expected)
```

Note: You can also use `expect(..).to_not` instead of `expect(..).not_to`.
Expand All @@ -25,26 +25,26 @@ Note: You can also use `expect(..).to_not` instead of `expect(..).not_to`.
#### Examples

```ruby
expect(5).to eq(5)
expect(5).not_to eq(4)
expect(5).to eq(5)
expect(5).not_to eq(4)
```

## What is a matcher?

A matcher is any object that responds to the following methods:

```ruby
matches?(actual)
failure_message
matches?(actual)
failure_message
```

These methods are also part of the matcher protocol, but are optional:

```ruby
does_not_match?(actual)
failure_message_when_negated
description
supports_block_expectations?
does_not_match?(actual)
failure_message_when_negated
description
supports_block_expectations?
```

RSpec ships with a number of built-in matchers and a DSL for writing custom
Expand Down

0 comments on commit 8412627

Please sign in to comment.