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

Commit 85cb4ee

Browse files
committed
refactor profiler specs to assert on hash changing
1 parent 4ee7e36 commit 85cb4ee

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spec/rspec/core/profiler_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def group
3030
it 'records example groups start time and description via id' do
3131
expect {
3232
profiler.example_group_started group_notification group
33-
}.to change { profiler.example_groups[group] }.to include(
34-
:start => now, :description => description
35-
)
33+
}.to change { profiler.example_groups[group] }.
34+
from(a_hash_excluding(:start, :description)).
35+
to(a_hash_including(:start => now, :description => description))
3636
end
3737
end
3838

@@ -45,9 +45,9 @@ def group
4545
it 'records example groups total time and description via id' do
4646
expect {
4747
profiler.example_group_finished group_notification group
48-
}.to change { profiler.example_groups[group] }.to include(
49-
:total_time => 1.0
50-
)
48+
}.to change { profiler.example_groups[group] }.
49+
from(a_hash_excluding(:total_time)).
50+
to(a_hash_including(:total_time => 1.0))
5151
end
5252
end
5353

spec/support/matchers.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,4 @@ def failure_reason(example)
123123
RSpec::Matchers.define_negated_matcher :exclude, :include
124124
RSpec::Matchers.define_negated_matcher :excluding, :include
125125
RSpec::Matchers.define_negated_matcher :avoid_changing, :change
126+
RSpec::Matchers.define_negated_matcher :a_hash_excluding, :include

0 commit comments

Comments
 (0)