Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 1a649fe

Browse files
committed
[opal-11-dev] Remove some usage of expect_any_instance_of
1 parent a529f1c commit 1a649fe

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

spec/react/callbacks_spec.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ def wash_hand
1313
end
1414
end
1515

16-
expect_any_instance_of(Foo).to receive(:wash_hand)
17-
Foo.new.run_callback(:before_dinner)
16+
instance = Foo.new
17+
expect(instance).to receive(:wash_hand)
18+
instance.run_callback(:before_dinner)
1819
end
1920

2021
it 'defines multiple callbacks' do
@@ -30,9 +31,10 @@ def wash_hand;end
3031
def turn_of_laptop;end
3132
end
3233

33-
expect_any_instance_of(Foo).to receive(:wash_hand)
34-
expect_any_instance_of(Foo).to receive(:turn_of_laptop)
35-
Foo.new.run_callback(:before_dinner)
34+
instance = Foo.new
35+
expect(instance).to receive(:wash_hand)
36+
expect(instance).to receive(:turn_of_laptop)
37+
instance.run_callback(:before_dinner)
3638
end
3739

3840
it 'defines block callback' do
@@ -95,9 +97,8 @@ def turn_of_laptop;end
9597
def eat_ice_cream(a,b,c); end
9698
end
9799

98-
expect_any_instance_of(Foo).to receive(:eat_ice_cream).with(4,5,6)
99-
100100
foo = Foo.new
101+
expect(foo).to receive(:eat_ice_cream).with(4,5,6)
101102
foo.run_callback(:before_dinner, 1, 2)
102103
foo.run_callback(:after_dinner, 4, 5, 6)
103104
expect(foo.lorem).to eq('1-2')

0 commit comments

Comments
 (0)