bogus 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/Guardfile +1 -3
- data/Guardfile.cucumber +0 -2
- data/README.md +1 -1
- data/bogus.gemspec +3 -1
- data/features/changelog.md +11 -0
- data/features/configuration/fake_ar_attributes.feature +2 -2
- data/features/contract_tests/contract_tests_mocks.feature +5 -5
- data/features/contract_tests/contract_tests_spies.feature +1 -1
- data/features/contract_tests/contract_tests_stubs.feature +6 -6
- data/features/contract_tests/custom_overwritten_class.feature +4 -4
- data/features/contract_tests/return_value_contracts.feature +2 -2
- data/features/fakes/anonymous_doubles.feature +5 -5
- data/features/fakes/duck_types.feature +9 -9
- data/features/fakes/fake_objects.feature +31 -8
- data/features/fakes/global_fake_configuration.feature +5 -5
- data/features/fakes/replacing_classes.feature +5 -5
- data/features/readme.md +5 -5
- data/features/safe_stubbing/argument_matchers.feature +23 -10
- data/features/safe_stubbing/safe_mocking.feature +1 -1
- data/features/safe_stubbing/safe_stubbing.feature +1 -1
- data/features/safe_stubbing/spies.feature +7 -7
- data/lib/bogus.rb +1 -0
- data/lib/bogus/core_ext.rb +22 -0
- data/lib/bogus/fakes/fake.rb +2 -1
- data/lib/bogus/fakes/method_stringifier.rb +1 -0
- data/lib/bogus/mocking_dsl.rb +4 -0
- data/lib/bogus/stubbing/has_overwritten_methods.rb +28 -10
- data/lib/bogus/stubbing/have_received_matcher.rb +4 -2
- data/lib/bogus/stubbing/matchers/any_args.rb +9 -0
- data/lib/bogus/stubbing/matchers/matches_argument.rb +11 -0
- data/lib/bogus/stubbing/{any_args.rb → matchers/with_arguments.rb} +0 -6
- data/lib/bogus/stubbing/overwrites_methods.rb +6 -1
- data/lib/bogus/stubbing/undefined_return_value.rb +4 -0
- data/lib/bogus/support.rb +11 -0
- data/lib/bogus/version.rb +1 -1
- data/spec/bogus/clean_ruby_spec.rb +1 -1
- data/spec/bogus/configuration_spec.rb +2 -2
- data/spec/bogus/contracts/adds_contract_verification_spec.rb +10 -10
- data/spec/bogus/contracts/adds_recording_spec.rb +4 -4
- data/spec/bogus/contracts/interactions_repository_spec.rb +15 -15
- data/spec/bogus/contracts/proxy_class_spec.rb +7 -7
- data/spec/bogus/contracts/records_double_interactions_spec.rb +1 -1
- data/spec/bogus/contracts/verifies_contracts_spec.rb +3 -3
- data/spec/bogus/fakes/base_class_identifier_spec.rb +1 -1
- data/spec/bogus/fakes/class_methods_spec.rb +4 -5
- data/spec/bogus/fakes/converts_name_to_class_spec.rb +3 -3
- data/spec/bogus/fakes/copies_classes_spec.rb +20 -16
- data/spec/bogus/fakes/creates_fakes_spec.rb +6 -6
- data/spec/bogus/fakes/creates_fakes_with_stubbed_methods_spec.rb +16 -15
- data/spec/bogus/fakes/fake_ar_attributes_spec.rb +3 -3
- data/spec/bogus/fakes/fake_configuration_spec.rb +16 -16
- data/spec/bogus/fakes/fake_registry_spec.rb +2 -2
- data/spec/bogus/fakes/fake_spec.rb +1 -1
- data/spec/bogus/fakes/fakes_classes_spec.rb +4 -4
- data/spec/bogus/fakes/faking_factories_spec.rb +4 -4
- data/spec/bogus/fakes/frozen_fakes_spec.rb +4 -4
- data/spec/bogus/fakes/instance_methods_spec.rb +5 -5
- data/spec/bogus/fakes/makes_ducks_spec.rb +3 -3
- data/spec/bogus/fakes/makes_substitute_methods_spec.rb +1 -1
- data/spec/bogus/fakes/overwriten_classes_spec.rb +3 -3
- data/spec/bogus/fakes/overwrites_classes_spec.rb +2 -2
- data/spec/bogus/fakes/registers_created_fakes_spec.rb +3 -3
- data/spec/bogus/fakes/resets_overwritten_classes_spec.rb +3 -3
- data/spec/bogus/fakes/stubbing_new_method_on_fake_class_spec.rb +25 -0
- data/spec/bogus/mocking_dsl_spec.rb +36 -36
- data/spec/bogus/ruby_2_1_support_spec.rb +38 -0
- data/spec/bogus/ruby_2_support_spec.rb +14 -64
- data/spec/bogus/stubbing/anything_spec.rb +5 -5
- data/spec/bogus/stubbing/double_spec.rb +2 -2
- data/spec/bogus/stubbing/have_received_matcher_spec.rb +11 -6
- data/spec/bogus/stubbing/interaction_spec.rb +7 -7
- data/spec/bogus/stubbing/multi_stubber_spec.rb +2 -2
- data/spec/bogus/stubbing/overwrites_methods_spec.rb +8 -8
- data/spec/bogus/stubbing/record_interactions_spec.rb +3 -3
- data/spec/bogus/stubbing/shadow_spec.rb +28 -28
- data/spec/bogus/stubbing/stubbing_existing_methods_on_fakes_spec.rb +50 -0
- data/spec/bogus/stubbing/tracks_existence_of_test_doubles_spec.rb +2 -2
- data/spec/bogus/stubbing/undefined_return_value_spec.rb +2 -2
- data/spec/spec_helper.rb +6 -1
- data/spec/support/shared_examples_for_keyword_arguments.rb +63 -0
- metadata +160 -160
- data/Gemfile.lock +0 -146
@@ -23,15 +23,15 @@ describe Bogus::CreatesFakes do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "creates a new instance of copied class by default" do
|
26
|
-
creates_fakes.create(:foo).
|
26
|
+
expect(creates_fakes.create(:foo)).to eq fake_instance
|
27
27
|
end
|
28
28
|
|
29
29
|
it "creates a new instance of copied class if called with as: :instance" do
|
30
|
-
creates_fakes.create(:foo, as: :instance).
|
30
|
+
expect(creates_fakes.create(:foo, as: :instance)).to eq fake_instance
|
31
31
|
end
|
32
32
|
|
33
33
|
it "copies class but does not create an instance if called with as: :class" do
|
34
|
-
creates_fakes.create(:foo, as: :class).
|
34
|
+
expect(creates_fakes.create(:foo, as: :class)).to eq fake_class
|
35
35
|
end
|
36
36
|
|
37
37
|
it "raises an error if the as mode is not known" do
|
@@ -48,13 +48,13 @@ describe Bogus::CreatesFakes do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "uses the class provided" do
|
51
|
-
creates_fakes.create(:foo){Bar}.
|
51
|
+
expect(creates_fakes.create(:foo){Bar}).to eq fake_instance
|
52
52
|
end
|
53
53
|
|
54
54
|
it "does not convert the class name" do
|
55
55
|
creates_fakes.create(:foo) { Bar}
|
56
56
|
|
57
|
-
copies_classes.
|
57
|
+
expect(copies_classes).to_not have_received.convert
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -68,7 +68,7 @@ describe Bogus::CreatesFakes do
|
|
68
68
|
|
69
69
|
fake = creates_fakes.create(:role, as: :class) { [Foo, Bar] }
|
70
70
|
|
71
|
-
fake.
|
71
|
+
expect(fake).to eq :the_fake
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -5,12 +5,13 @@ module Bogus
|
|
5
5
|
let(:creates_fakes) { FakeCreatorOfFakes.new }
|
6
6
|
let(:fake_configuration) { stub }
|
7
7
|
let(:responds_to_everything) { stub }
|
8
|
-
let(:multi_stubber) { stub
|
8
|
+
let(:multi_stubber) { stub }
|
9
9
|
|
10
10
|
let(:creates_anonymous_stubs) { isolate(CreatesFakesWithStubbedMethods) }
|
11
11
|
|
12
12
|
before do
|
13
13
|
stub(fake_configuration).include? { false }
|
14
|
+
stub(multi_stubber).stub_all { :stubbed_object }
|
14
15
|
end
|
15
16
|
|
16
17
|
context "given symbol as first parameter" do
|
@@ -21,11 +22,11 @@ module Bogus
|
|
21
22
|
end
|
22
23
|
|
23
24
|
it "creates fakes" do
|
24
|
-
creates_fakes.
|
25
|
+
expect(creates_fakes).to have_created(:foo, {as: :class}, "something")
|
25
26
|
end
|
26
27
|
|
27
28
|
it "stubs all the given methods" do
|
28
|
-
multi_stubber.
|
29
|
+
expect(multi_stubber).to have_received.stub_all(fake, bar: 1)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -35,11 +36,11 @@ module Bogus
|
|
35
36
|
end
|
36
37
|
|
37
38
|
it "does not create fakes" do
|
38
|
-
creates_fakes.fakes.
|
39
|
+
expect(creates_fakes.fakes).to eq []
|
39
40
|
end
|
40
41
|
|
41
42
|
it "stubs all the given methods" do
|
42
|
-
multi_stubber.
|
43
|
+
expect(multi_stubber).to have_received.stub_all(responds_to_everything, bar: 1)
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -51,11 +52,11 @@ module Bogus
|
|
51
52
|
end
|
52
53
|
|
53
54
|
it "creates fakes" do
|
54
|
-
creates_fakes.
|
55
|
+
expect(creates_fakes).to have_created(:foo, {}, "something")
|
55
56
|
end
|
56
57
|
|
57
58
|
it "stubs all the given methods" do
|
58
|
-
multi_stubber.
|
59
|
+
expect(multi_stubber).to have_received.stub_all(fake, {})
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
@@ -65,11 +66,11 @@ module Bogus
|
|
65
66
|
end
|
66
67
|
|
67
68
|
it "does not create fakes" do
|
68
|
-
creates_fakes.fakes.
|
69
|
+
expect(creates_fakes.fakes).to eq []
|
69
70
|
end
|
70
71
|
|
71
72
|
it "stubs all the given methods" do
|
72
|
-
multi_stubber.
|
73
|
+
expect(multi_stubber).to have_received.stub_all(responds_to_everything, {})
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
@@ -86,14 +87,14 @@ module Bogus
|
|
86
87
|
end
|
87
88
|
|
88
89
|
it "uses the configuration to create fake" do
|
89
|
-
creates_fakes.fakes.
|
90
|
+
expect(creates_fakes.fakes).to eq [fake]
|
90
91
|
|
91
|
-
fake_configuration.
|
92
|
-
fake_configuration.
|
92
|
+
expect(fake_configuration).to have_received.include?(:foo)
|
93
|
+
expect(fake_configuration).to have_received.get(:foo)
|
93
94
|
end
|
94
95
|
|
95
96
|
it "stubs the methods defined in configuration" do
|
96
|
-
multi_stubber.
|
97
|
+
expect(multi_stubber).to have_received.stub_all(fake, xyz: "abc")
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
@@ -110,11 +111,11 @@ module Bogus
|
|
110
111
|
end
|
111
112
|
|
112
113
|
it "overrides the class block and fake options" do
|
113
|
-
creates_fakes.
|
114
|
+
expect(creates_fakes).to have_created(:foo, {as: :instance}, "SomeOtherClass")
|
114
115
|
end
|
115
116
|
|
116
117
|
it "overrides the stubbed methods" do
|
117
|
-
multi_stubber.
|
118
|
+
expect(multi_stubber).to have_received.stub_all(fake, a: "b", b: "d", c: "e")
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
@@ -30,7 +30,7 @@ describe "Stubbing ActiveRecord::Base subclasses" do
|
|
30
30
|
it "makes it possible to stub active record fields" do
|
31
31
|
post = fake(:blog_post, name: "hello")
|
32
32
|
|
33
|
-
post.name.
|
33
|
+
expect(post.name).to eq "hello"
|
34
34
|
end
|
35
35
|
|
36
36
|
it "works only when enabled in configuration" do
|
@@ -48,7 +48,7 @@ describe "Stubbing ActiveRecord::Base subclasses" do
|
|
48
48
|
|
49
49
|
post.author("hello")
|
50
50
|
|
51
|
-
post.
|
51
|
+
expect(post).to have_received.author("hello")
|
52
52
|
end
|
53
53
|
|
54
54
|
class ExampleForActiveRecordAttributes
|
@@ -61,7 +61,7 @@ describe "Stubbing ActiveRecord::Base subclasses" do
|
|
61
61
|
|
62
62
|
fake.foo(1)
|
63
63
|
|
64
|
-
fake.
|
64
|
+
expect(fake).to have_received.foo(1)
|
65
65
|
end
|
66
66
|
|
67
67
|
after do
|
@@ -4,7 +4,7 @@ describe Bogus::FakeConfiguration do
|
|
4
4
|
let(:config) { Bogus::FakeConfiguration.new }
|
5
5
|
|
6
6
|
it "does not contain not configured fakes" do
|
7
|
-
config.include?(:foo).
|
7
|
+
expect(config.include?(:foo)).to be_false
|
8
8
|
end
|
9
9
|
|
10
10
|
def class_block(name)
|
@@ -26,8 +26,8 @@ describe Bogus::FakeConfiguration do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
config.include?(:foo).
|
30
|
-
config.include?(:bar).
|
29
|
+
expect(config.include?(:foo)).to be_true
|
30
|
+
expect(config.include?(:bar)).to be_false
|
31
31
|
end
|
32
32
|
|
33
33
|
it "returns the configuration for a fake" do
|
@@ -37,9 +37,9 @@ describe Bogus::FakeConfiguration do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
opts(:foo).
|
41
|
-
stubs(:foo).
|
42
|
-
class_block(:foo).call.
|
40
|
+
expect(opts(:foo)).to eq ({ as: :class} )
|
41
|
+
expect(stubs(:foo)).to eq ({ bar: "the bar"} )
|
42
|
+
expect(class_block(:foo).call).to eq Samples::Foo
|
43
43
|
end
|
44
44
|
|
45
45
|
context "with no class" do
|
@@ -48,9 +48,9 @@ describe Bogus::FakeConfiguration do
|
|
48
48
|
fake(:foo, as: :class) { bar "bar" }
|
49
49
|
end
|
50
50
|
|
51
|
-
opts(:foo).
|
52
|
-
stubs(:foo).
|
53
|
-
class_block(:foo).
|
51
|
+
expect(opts(:foo)).to eq ({ as: :class} )
|
52
|
+
expect(stubs(:foo)).to eq ({ bar: "bar"} )
|
53
|
+
expect(class_block(:foo)).to be_nil
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -60,9 +60,9 @@ describe Bogus::FakeConfiguration do
|
|
60
60
|
fake(:foo) { bar "bar" }
|
61
61
|
end
|
62
62
|
|
63
|
-
opts(:foo).
|
64
|
-
stubs(:foo).
|
65
|
-
class_block(:foo).
|
63
|
+
expect(opts(:foo)).to eq ({ } )
|
64
|
+
expect(stubs(:foo)).to eq ({ bar: "bar"} )
|
65
|
+
expect(class_block(:foo)).to be_nil
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -72,7 +72,7 @@ describe Bogus::FakeConfiguration do
|
|
72
72
|
fake(:foo) { bar {"bar"} }
|
73
73
|
end
|
74
74
|
|
75
|
-
stubs(:foo)[:bar].call.
|
75
|
+
expect(stubs(:foo)[:bar].call).to eq "bar"
|
76
76
|
end
|
77
77
|
|
78
78
|
it "does not evaluate the blocks when getting, nor when setting" do
|
@@ -91,9 +91,9 @@ describe Bogus::FakeConfiguration do
|
|
91
91
|
fake(:foo, as: :class)
|
92
92
|
end
|
93
93
|
|
94
|
-
opts(:foo).
|
95
|
-
stubs(:foo).
|
96
|
-
class_block(:foo).
|
94
|
+
expect(opts(:foo)).to eq ({ as: :class} )
|
95
|
+
expect(stubs(:foo)).to eq ({ } )
|
96
|
+
expect(class_block(:foo)).to be_nil
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
@@ -8,7 +8,7 @@ describe Bogus::FakeRegistry do
|
|
8
8
|
|
9
9
|
fake_registry.store(:name, object)
|
10
10
|
|
11
|
-
fake_registry.name(object).
|
11
|
+
expect(fake_registry.name(object)).to eq :name
|
12
12
|
end
|
13
13
|
|
14
14
|
it "returns name based on object identity" do
|
@@ -19,6 +19,6 @@ describe Bogus::FakeRegistry do
|
|
19
19
|
|
20
20
|
fake_registry.store(:object, object)
|
21
21
|
|
22
|
-
fake_registry.name(duplicate).
|
22
|
+
expect(fake_registry.name(duplicate)).to be_nil
|
23
23
|
end
|
24
24
|
end
|
@@ -20,7 +20,7 @@ describe Bogus::FakesClasses do
|
|
20
20
|
it "creates a fake named after the class" do
|
21
21
|
fakes_classes.fake(Samples::WillBeOverwritten, foo: "bar")
|
22
22
|
|
23
|
-
creates_fakes_with_stubbed_methods.
|
23
|
+
expect(creates_fakes_with_stubbed_methods).to have_created(:will_be_overwritten,
|
24
24
|
{as: :class, foo: "bar"}, Samples::WillBeOverwritten)
|
25
25
|
end
|
26
26
|
|
@@ -29,18 +29,18 @@ describe Bogus::FakesClasses do
|
|
29
29
|
|
30
30
|
fakes_classes.fake(Samples::WillBeOverwritten)
|
31
31
|
|
32
|
-
overwrites_classes.
|
32
|
+
expect(overwrites_classes).to have_received.overwrite("Samples::WillBeOverwritten", fake)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "stores the overwritten class so that it can be replaced back later" do
|
36
36
|
fakes_classes.fake(Samples::WillBeOverwritten)
|
37
37
|
|
38
|
-
overwritten_classes.
|
38
|
+
expect(overwritten_classes).to have_received.add("Samples::WillBeOverwritten", Samples::WillBeOverwritten)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "uses the passed fake name if provided" do
|
42
42
|
fakes_classes.fake(Samples::WillBeOverwritten, fake_name: :foo_bar)
|
43
43
|
|
44
|
-
creates_fakes_with_stubbed_methods.
|
44
|
+
expect(creates_fakes_with_stubbed_methods).to have_created(:foo_bar, {as: :class}, Samples::WillBeOverwritten)
|
45
45
|
end
|
46
46
|
end
|
@@ -24,7 +24,7 @@ describe "Faking Factories" do
|
|
24
24
|
|
25
25
|
factory.create(2)
|
26
26
|
|
27
|
-
model_class.
|
27
|
+
expect(model_class).to have_received.new(1, 2)
|
28
28
|
end
|
29
29
|
|
30
30
|
class ExampleModel2
|
@@ -49,7 +49,7 @@ describe "Faking Factories" do
|
|
49
49
|
|
50
50
|
model = model_class.new
|
51
51
|
|
52
|
-
model_class.
|
52
|
+
expect(model_class).to have_received.new
|
53
53
|
end
|
54
54
|
|
55
55
|
class ExampleModel4
|
@@ -65,7 +65,7 @@ describe "Faking Factories" do
|
|
65
65
|
|
66
66
|
model.foo(1)
|
67
67
|
|
68
|
-
model.
|
68
|
+
expect(model).to have_received.foo(1)
|
69
69
|
end
|
70
70
|
|
71
71
|
module ExampleModel5
|
@@ -78,6 +78,6 @@ describe "Faking Factories" do
|
|
78
78
|
|
79
79
|
model.foo(1)
|
80
80
|
|
81
|
-
model.
|
81
|
+
expect(model).to have_received.foo(1)
|
82
82
|
end
|
83
83
|
end
|
@@ -15,7 +15,7 @@ describe "Frozen Fakes" do
|
|
15
15
|
it "allows stubbing" do
|
16
16
|
stub(object).foo(1) { 123 }
|
17
17
|
|
18
|
-
object.foo(1).
|
18
|
+
expect(object.foo(1)).to eq 123
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -23,7 +23,7 @@ describe "Frozen Fakes" do
|
|
23
23
|
it "allows mocking" do
|
24
24
|
mock(object).foo(1) { 123 }
|
25
25
|
|
26
|
-
object.foo(1).
|
26
|
+
expect(object.foo(1)).to eq 123
|
27
27
|
end
|
28
28
|
|
29
29
|
it "allows verifying expectations" do
|
@@ -39,8 +39,8 @@ describe "Frozen Fakes" do
|
|
39
39
|
it "allows spying" do
|
40
40
|
object.foo(1)
|
41
41
|
|
42
|
-
object.
|
43
|
-
object.
|
42
|
+
expect(object).to have_received.foo(1)
|
43
|
+
expect(object).to_not have_received.foo(2)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -16,18 +16,18 @@ module Bogus
|
|
16
16
|
let(:instance_methods) { InstanceMethods.new(SampleClass) }
|
17
17
|
|
18
18
|
it "lists the instance methods" do
|
19
|
-
instance_methods.all.
|
19
|
+
expect(instance_methods.all).to match_array([:foo, :hello])
|
20
20
|
end
|
21
21
|
|
22
22
|
it "returns the instance methods by name" do
|
23
|
-
instance_methods.get(:foo).
|
24
|
-
SampleClass.instance_method(:foo)
|
23
|
+
expect(instance_methods.get(:foo)).to eq(
|
24
|
+
SampleClass.instance_method(:foo))
|
25
25
|
end
|
26
26
|
|
27
27
|
it "removes methods by name" do
|
28
28
|
instance_methods.remove(:hello)
|
29
29
|
|
30
|
-
SampleClass.new.
|
30
|
+
expect(SampleClass.new).to_not respond_to(:hello)
|
31
31
|
end
|
32
32
|
|
33
33
|
it "defines instance methods" do
|
@@ -39,7 +39,7 @@ module Bogus
|
|
39
39
|
|
40
40
|
instance = SampleClass.new
|
41
41
|
|
42
|
-
instance.greet("Joe").
|
42
|
+
expect(instance.greet("Joe")).to eq "Hello, Joe!"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -40,7 +40,7 @@ module Bogus
|
|
40
40
|
it { should respond_to(:foo) }
|
41
41
|
|
42
42
|
it "should have arity -3 for foo" do
|
43
|
-
duck.method(:foo).arity.
|
43
|
+
expect(duck.method(:foo).arity).to eq -3
|
44
44
|
end
|
45
45
|
|
46
46
|
it { should_not respond_to(:bar) }
|
@@ -76,11 +76,11 @@ module Bogus
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it "copies class methods" do
|
79
|
-
duck.
|
79
|
+
expect(duck).to respond_to(:enabled?)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "copies instance methods" do
|
83
|
-
duck_instance.
|
83
|
+
expect(duck_instance).to respond_to(:enabled?)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -14,7 +14,7 @@ module Bogus
|
|
14
14
|
it "makes a copy of the method with its params and adds recording" do
|
15
15
|
copy = makes_substitute_methods.stringify(SampleForCopyingMethods.method(:foo))
|
16
16
|
|
17
|
-
copy.
|
17
|
+
expect(copy).to eq <<-EOF
|
18
18
|
def foo(name, value = Bogus::DefaultValue, *rest, &block)
|
19
19
|
__record__(:foo, name, value, *rest, &block)
|
20
20
|
end
|
@@ -9,7 +9,7 @@ describe Bogus::OverwrittenClasses do
|
|
9
9
|
overwritten_classes.add("Foo::Bar", klass)
|
10
10
|
overwritten_classes.add("Baz::Bam", klass)
|
11
11
|
|
12
|
-
overwritten_classes.classes.
|
12
|
+
expect(overwritten_classes.classes).to eq [["Foo::Bar", klass],
|
13
13
|
["Baz::Bam", klass]]
|
14
14
|
end
|
15
15
|
|
@@ -18,10 +18,10 @@ describe Bogus::OverwrittenClasses do
|
|
18
18
|
overwritten_classes.add("Baz::Bam", klass)
|
19
19
|
overwritten_classes.clear
|
20
20
|
|
21
|
-
overwritten_classes.classes.
|
21
|
+
expect(overwritten_classes.classes).to eq []
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns an empty array with no classes" do
|
25
|
-
overwritten_classes.classes.
|
25
|
+
expect(overwritten_classes.classes).to eq []
|
26
26
|
end
|
27
27
|
end
|