rr 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rr/injections/double_injection.rb +2 -1
- data/lib/rr/version.rb +1 -1
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_spec.rb +0 -12
- metadata +3 -6
- data/spec/suites/rspec_2/integration/rspec_2_spec.rb +0 -133
- data/spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb +0 -173
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35d55fd0d14916ec412865fa0093c5c3ecf6af07
|
4
|
+
data.tar.gz: e5dd7d9dbddb7c2dfe272de8a0fb9e3c18ffbf9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3013497ba6d79be17044b1da4efa0806f8c608840d46603fc05ec255aebdc701946cd097d9032a017f88ff2e672c5a065d0a4a4a14431bb5d0b0c6c431a3c9d3
|
7
|
+
data.tar.gz: 066dc64081fc2b385185e25bd4f56612b90f14c9788ab8ca78fb17b5593542fb601b33108703ce637770d28c2a90a4dd00edac809447b59f09755e7bbe73588f
|
@@ -206,7 +206,8 @@ module RR
|
|
206
206
|
|
207
207
|
protected
|
208
208
|
def deferred_bind_method
|
209
|
-
|
209
|
+
if respond_to?(method_name) and
|
210
|
+
not subject_has_method_defined?(original_method_alias_name)
|
210
211
|
bind_method_with_alias
|
211
212
|
end
|
212
213
|
@performed_deferred_bind = true
|
data/lib/rr/version.rb
CHANGED
@@ -231,12 +231,6 @@ module RR
|
|
231
231
|
end
|
232
232
|
|
233
233
|
describe "being called" do
|
234
|
-
it "defines __rr__original_{method_name} to be the lazily created method" do
|
235
|
-
subject.foobar
|
236
|
-
expect((!!subject.methods.detect {|method| method.to_sym == :__rr__original_foobar})).to be_true
|
237
|
-
expect(subject.__rr__original_foobar).to eq :original_foobar
|
238
|
-
end
|
239
|
-
|
240
234
|
it "calls the lazily created method and returns the injected method return value" do
|
241
235
|
original_return_value = nil
|
242
236
|
stub.proxy(subject).foobar {|arg| original_return_value = arg; :new_foobar}
|
@@ -383,12 +377,6 @@ module RR
|
|
383
377
|
end
|
384
378
|
|
385
379
|
describe "being called" do
|
386
|
-
it "defines __rr__original_{method_name} to be the lazily created method" do
|
387
|
-
subject.foobar
|
388
|
-
expect((!!subject.methods.detect {|method| method.to_sym == :__rr__original_foobar})).to be_true
|
389
|
-
expect(subject.__rr__original_foobar).to eq :original_foobar
|
390
|
-
end
|
391
|
-
|
392
380
|
it "calls the lazily created method and returns the injected method return value" do
|
393
381
|
original_return_value = nil
|
394
382
|
stub.proxy(subject).foobar {|arg| original_return_value = arg; :new_foobar}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-07-22 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: RR is a test double framework that features a rich selection of double
|
16
16
|
techniques and a terse syntax.
|
@@ -154,7 +154,6 @@ files:
|
|
154
154
|
- spec/suites/rspec_2/helper.rb
|
155
155
|
- spec/suites/rspec_2/integration/minitest_4_spec.rb
|
156
156
|
- spec/suites/rspec_2/integration/minitest_spec.rb
|
157
|
-
- spec/suites/rspec_2/integration/rspec_2_spec.rb
|
158
157
|
- spec/suites/rspec_2/spec_helper.rb
|
159
158
|
- spec/suites/rspec_2/support/matchers/wildcard_matcher_matchers.rb
|
160
159
|
- spec/suites/rspec_2/support/mixins/double_definition_creator_helpers.rb
|
@@ -235,7 +234,6 @@ files:
|
|
235
234
|
- spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
|
236
235
|
- spec/suites/rspec_2_rails_4/integration/astc_rails_4_spec.rb
|
237
236
|
- spec/suites/rspec_2_rails_4/integration/minitest_4_rails_4_spec.rb
|
238
|
-
- spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb
|
239
237
|
- spec/suites/rspec_2_rails_4/spec_helper.rb
|
240
238
|
- spec/support/adapter.rb
|
241
239
|
- spec/support/adapter_tests/base.rb
|
@@ -313,10 +311,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
311
|
version: '0'
|
314
312
|
requirements: []
|
315
313
|
rubyforge_project:
|
316
|
-
rubygems_version: 2.5.
|
314
|
+
rubygems_version: 2.5.2
|
317
315
|
signing_key:
|
318
316
|
specification_version: 4
|
319
317
|
summary: RR is a test double framework that features a rich selection of double techniques
|
320
318
|
and a terse syntax.
|
321
319
|
test_files: []
|
322
|
-
has_rdoc:
|
@@ -1,133 +0,0 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe 'Integration with RSpec 2' do
|
4
|
-
include IntegrationTests::RubyRSpec
|
5
|
-
|
6
|
-
def configure_project_generator(project_generator)
|
7
|
-
super
|
8
|
-
project_generator.configure do |project|
|
9
|
-
project.rspec_version = 2
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.including_the_adapter_manually_works
|
14
|
-
specify "including the adapter manually works" do
|
15
|
-
project = generate_project do |project|
|
16
|
-
project.add_to_prelude <<-EOT
|
17
|
-
RSpec.configure do |c|
|
18
|
-
c.mock_with :rr
|
19
|
-
end
|
20
|
-
EOT
|
21
|
-
end
|
22
|
-
project.add_test_file do |file|
|
23
|
-
file.add_working_test_case_with_adapter_tests do |test_case|
|
24
|
-
test_case.add_to_body <<-EOT
|
25
|
-
it 'loads the correct adapters' do
|
26
|
-
assert_adapters_loaded #{adapters_that_should_be_loaded.inspect}
|
27
|
-
end
|
28
|
-
EOT
|
29
|
-
end
|
30
|
-
end
|
31
|
-
result = project.run_tests
|
32
|
-
result.should be_success
|
33
|
-
result.should_not have_errors_or_failures
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.rr_hooks_into_the_test_framework_automatically
|
38
|
-
specify "RR hooks into the test framework automatically" do
|
39
|
-
project = generate_project
|
40
|
-
project.add_test_file do |file|
|
41
|
-
file.add_working_test_case
|
42
|
-
end
|
43
|
-
result = project.run_tests
|
44
|
-
result.should be_success
|
45
|
-
result.should_not have_errors_or_failures
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'when Bundler is autorequiring RR' do
|
50
|
-
def configure_project_generator(project_generator)
|
51
|
-
super
|
52
|
-
project_generator.configure do |project|
|
53
|
-
project.autorequire_gems = true
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def adapters_that_should_be_loaded
|
58
|
-
[:RSpec2]
|
59
|
-
end
|
60
|
-
|
61
|
-
including_the_adapter_manually_works
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'when RR is being required manually' do
|
65
|
-
def configure_project_generator(project_generator)
|
66
|
-
super
|
67
|
-
project_generator.configure do |project|
|
68
|
-
project.autorequire_gems = false
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def adapters_that_should_be_loaded
|
73
|
-
[:RSpec2]
|
74
|
-
end
|
75
|
-
|
76
|
-
rr_hooks_into_the_test_framework_automatically
|
77
|
-
including_the_adapter_manually_works
|
78
|
-
|
79
|
-
specify "when RR raises an error it raises a failure not an exception" do
|
80
|
-
project = generate_project
|
81
|
-
project.add_test_file do |file|
|
82
|
-
file.add_test_case do |test_case|
|
83
|
-
test_case.add_test <<-EOT
|
84
|
-
object = Object.new
|
85
|
-
mock(object).foo
|
86
|
-
EOT
|
87
|
-
end
|
88
|
-
end
|
89
|
-
result = project.run_tests
|
90
|
-
result.should fail_with_output(/1 failure/)
|
91
|
-
end
|
92
|
-
|
93
|
-
specify "it is still possible to use a custom RSpec-2 adapter" do
|
94
|
-
project = generate_project do |project|
|
95
|
-
project.add_to_prelude <<-EOT
|
96
|
-
module RR
|
97
|
-
module Adapters
|
98
|
-
module RSpec2
|
99
|
-
include RRMethods
|
100
|
-
|
101
|
-
def setup_mocks_for_rspec
|
102
|
-
RR.reset
|
103
|
-
end
|
104
|
-
|
105
|
-
def verify_mocks_for_rspec
|
106
|
-
RR.verify
|
107
|
-
end
|
108
|
-
|
109
|
-
def teardown_mocks_for_rspec
|
110
|
-
RR.reset
|
111
|
-
end
|
112
|
-
|
113
|
-
def have_received(method = nil)
|
114
|
-
RR::Adapters::Rspec::InvocationMatcher.new(method)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
RSpec.configure do |c|
|
121
|
-
c.mock_with RR::Adapters::RSpec2
|
122
|
-
end
|
123
|
-
EOT
|
124
|
-
end
|
125
|
-
project.add_test_file do |file|
|
126
|
-
file.add_test_case_with_adapter_tests
|
127
|
-
end
|
128
|
-
result = project.run_tests
|
129
|
-
result.should be_success
|
130
|
-
result.should_not have_errors_or_failures
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,173 +0,0 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe 'Integration with RSpec 2 and Rails 4' do
|
4
|
-
include IntegrationTests::RailsRSpec
|
5
|
-
|
6
|
-
def configure_rails_project_generator(project_generator)
|
7
|
-
super
|
8
|
-
project_generator.configure do |project|
|
9
|
-
project.rails_version = 4
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def configure_project_generator(project_generator)
|
14
|
-
super
|
15
|
-
project_generator.configure do |project|
|
16
|
-
project.rspec_version = 2
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.including_the_adapter_manually_works
|
21
|
-
specify "including the adapter manually works" do
|
22
|
-
project = generate_project do |project|
|
23
|
-
project.add_to_prelude <<-EOT
|
24
|
-
RSpec.configure do |c|
|
25
|
-
c.mock_with :rr
|
26
|
-
end
|
27
|
-
EOT
|
28
|
-
end
|
29
|
-
project.add_test_file do |file|
|
30
|
-
file.add_working_test_case_with_adapter_tests do |test_case|
|
31
|
-
test_case.add_to_body <<-EOT
|
32
|
-
it 'loads the correct adapters' do
|
33
|
-
assert_adapters_loaded #{adapters_that_should_be_loaded.inspect}
|
34
|
-
end
|
35
|
-
EOT
|
36
|
-
end
|
37
|
-
end
|
38
|
-
result = project.run_tests
|
39
|
-
result.should be_success
|
40
|
-
result.should_not have_errors_or_failures
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.rr_hooks_into_the_test_framework_automatically
|
45
|
-
specify "RR hooks into the test framework automatically" do
|
46
|
-
project = generate_project
|
47
|
-
project.add_test_file do |file|
|
48
|
-
file.add_working_test_case
|
49
|
-
end
|
50
|
-
result = project.run_tests
|
51
|
-
result.should be_success
|
52
|
-
result.should_not have_errors_or_failures
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.using_rr_with_cucumber_works
|
57
|
-
specify "using RR with Cucumber works" do
|
58
|
-
pending "Cucumber doesn't work with Rails 4 just yet"
|
59
|
-
project_generator = build_rails_project_generator do |project_generator|
|
60
|
-
project_generator.mixin Project::Cucumber
|
61
|
-
end
|
62
|
-
project = project_generator.call
|
63
|
-
result = project.run_command_within("bundle exec cucumber")
|
64
|
-
result.should be_success
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'when Bundler is autorequiring RR' do
|
69
|
-
def configure_project_generator(project_generator)
|
70
|
-
super
|
71
|
-
project_generator.configure do |project|
|
72
|
-
project.autorequire_gems = true
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def adapters_that_should_be_loaded
|
77
|
-
[:RSpec2]
|
78
|
-
end
|
79
|
-
|
80
|
-
including_the_adapter_manually_works
|
81
|
-
using_rr_with_cucumber_works
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'when RR is being required manually' do
|
85
|
-
def configure_project_generator(project_generator)
|
86
|
-
super
|
87
|
-
project_generator.configure do |project|
|
88
|
-
project.autorequire_gems = false
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def adapters_that_should_be_loaded
|
93
|
-
[:RSpec2]
|
94
|
-
end
|
95
|
-
|
96
|
-
rr_hooks_into_the_test_framework_automatically
|
97
|
-
including_the_adapter_manually_works
|
98
|
-
using_rr_with_cucumber_works
|
99
|
-
|
100
|
-
specify "when RR raises an error it raises a failure not an exception" do
|
101
|
-
project = generate_project
|
102
|
-
project.add_test_file do |file|
|
103
|
-
file.add_test_case do |test_case|
|
104
|
-
test_case.add_test <<-EOT
|
105
|
-
object = Object.new
|
106
|
-
mock(object).foo
|
107
|
-
EOT
|
108
|
-
end
|
109
|
-
end
|
110
|
-
result = project.run_tests
|
111
|
-
result.should fail_with_output(/1 failure/)
|
112
|
-
end
|
113
|
-
|
114
|
-
specify "the database is properly rolled back after an RR error" do
|
115
|
-
project = generate_project do |project|
|
116
|
-
project.add_model_and_migration(:person, :people, :name => :string)
|
117
|
-
end
|
118
|
-
project.add_test_file do |file|
|
119
|
-
file.add_test_case do |test_case|
|
120
|
-
test_case.add_test <<-EOT
|
121
|
-
Person.create!(:name => 'Joe Blow')
|
122
|
-
object = Object.new
|
123
|
-
mock(object).foo
|
124
|
-
EOT
|
125
|
-
end
|
126
|
-
end
|
127
|
-
expect {
|
128
|
-
result = project.run_tests
|
129
|
-
result.should have_errors_or_failures
|
130
|
-
}.to leave_database_table_clear(project, :people)
|
131
|
-
end
|
132
|
-
|
133
|
-
specify "it is still possible to use a custom RSpec-2 adapter" do
|
134
|
-
project = generate_project do |project|
|
135
|
-
project.add_to_prelude <<-EOT
|
136
|
-
module RR
|
137
|
-
module Adapters
|
138
|
-
module RSpec2
|
139
|
-
include RRMethods
|
140
|
-
|
141
|
-
def setup_mocks_for_rspec
|
142
|
-
RR.reset
|
143
|
-
end
|
144
|
-
|
145
|
-
def verify_mocks_for_rspec
|
146
|
-
RR.verify
|
147
|
-
end
|
148
|
-
|
149
|
-
def teardown_mocks_for_rspec
|
150
|
-
RR.reset
|
151
|
-
end
|
152
|
-
|
153
|
-
def have_received(method = nil)
|
154
|
-
RR::Adapters::Rspec::InvocationMatcher.new(method)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
RSpec.configure do |c|
|
161
|
-
c.mock_with RR::Adapters::RSpec2
|
162
|
-
end
|
163
|
-
EOT
|
164
|
-
end
|
165
|
-
project.add_test_file do |file|
|
166
|
-
file.add_test_case_with_adapter_tests
|
167
|
-
end
|
168
|
-
result = project.run_tests
|
169
|
-
result.should be_success
|
170
|
-
result.should_not have_errors_or_failures
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|