-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_specs.rb
More file actions
62 lines (58 loc) · 1.29 KB
/
example_specs.rb
File metadata and controls
62 lines (58 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
RSpec.shared_examples 'Example Failing Specs' do
it do
expect(
id: 1,
data: {
name: 'John Appleseed',
}
).to match(
id: "1",
data: {
name: 'John Berry',
}
)
end
it do
expect(
status: 422,
message: 'Your request to update record with id 42 was not processed.',
).to match(
status: 422,
message: 'Your reqest to udpate record with id 43 was not processed.',
)
end
it do
expect(
california: ['los angeeles', 'san francisco'],
oregon: ['portland', 'eugene'],
washington: ['seattle', 'spokane'],
new_york: ['new york city', 'albany'],
texas: ['houston', 'austin'],
).to match(
california: ['los angeles', 'san francisco'],
oregon: ['potland', 'eugene'],
washington: ['seattle', 'spokane'],
new_york: ['new york city', 'albany'],
texas: ['houston', 'austin'],
montana: ['billings', 'helena'],
)
end
it do
expect(
unknown: 'any value is acceptable',
number: 1,
).to match(
unknown: anything,
number: '1',
)
end
it do
expect(
nested_hash: { some_key: :some_value },
number: 1,
).to match(
nested_hash: hash_including(:some_key),
number: '1',
)
end
end