gimme 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/VERSION +1 -1
- data/features/messages.feature +2 -2
- data/features/step_definitions/doc_steps.rb +1 -1
- data/features/step_definitions/gimme_steps.rb +1 -1
- data/gimme.gemspec +2 -2
- data/lib/gimme/spies_on_class_methods.rb +2 -2
- data/spec/gimme/spies_on_class_method_spec.rb +21 -2
- metadata +5 -2
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
data/features/messages.feature
CHANGED
@@ -26,11 +26,11 @@ Feature: messages from test doubles
|
|
26
26
|
"""
|
27
27
|
Then we should see a failure message that includes:
|
28
28
|
"""
|
29
|
-
expected Person#sit_on to have been called with arguments [
|
29
|
+
expected Person#sit_on to have been called with arguments \[?<#Gimme:1 Chair>\]?
|
30
30
|
"""
|
31
31
|
Then we should see a failure message that includes:
|
32
32
|
"""
|
33
|
-
was actually called 1 times with arguments []
|
33
|
+
was actually called 1 times with arguments \[?\]?
|
34
34
|
"""
|
35
35
|
|
36
36
|
Scenario: naming mocks
|
@@ -29,7 +29,7 @@ end
|
|
29
29
|
|
30
30
|
Then /^we should see a failure message that includes:$/ do |string|
|
31
31
|
fail "expected a prior step to have raised error" unless @last_error
|
32
|
-
@last_error.message.should
|
32
|
+
@last_error.message.should =~ Regexp.new(string)
|
33
33
|
end
|
34
34
|
|
35
35
|
Given /^this RSpec will pass:$/ do |spec_code|
|
data/gimme.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gimme"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Searls"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-03-06"
|
13
13
|
s.description = "gimme attempts to bring to Ruby a test double workflow akin to Mockito in Java. Major distinctions include preserving arrange-act-assert in tests, fast feedback for methods the double's real counterpart may not know how to respond to, no string/symbolic representations of methods, argument captors, and strong opinions (weakly held). "
|
14
14
|
s.email = "searls@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -12,7 +12,7 @@ module Gimme
|
|
12
12
|
|
13
13
|
if meta_class.method_defined? method
|
14
14
|
Gimme.class_methods.set(@cls, method)
|
15
|
-
meta_class.send(:
|
15
|
+
meta_class.send(:undef_method, method)
|
16
16
|
end
|
17
17
|
|
18
18
|
cls = @cls
|
@@ -25,4 +25,4 @@ module Gimme
|
|
25
25
|
EnsuresClassMethodRestoration.new(@cls).ensure(method)
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -1,7 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Gimme
|
4
|
-
class
|
4
|
+
class Factory
|
5
|
+
|
6
|
+
def self.inherited_build
|
7
|
+
raise RuntimeError.new "unimplemented feature"
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
class ChairFactory < Factory
|
5
13
|
|
6
14
|
def self.build
|
7
15
|
raise RuntimeError.new "unimplemented feature"
|
@@ -23,7 +31,16 @@ module Gimme
|
|
23
31
|
When { Gimme.reset }
|
24
32
|
Then { invocation.should raise_error }
|
25
33
|
end
|
34
|
+
end
|
26
35
|
|
36
|
+
describe "inherited class method spy" do
|
37
|
+
Given(:invocation) { lambda { ChairFactory.inherited_build } }
|
38
|
+
Then { invocation.should_not raise_error }
|
39
|
+
|
40
|
+
context "upon reset" do
|
41
|
+
When { Gimme.reset }
|
42
|
+
Then { invocation.should raise_error }
|
43
|
+
end
|
27
44
|
end
|
28
45
|
|
29
46
|
describe "imaginary class method spy" do
|
@@ -41,6 +58,7 @@ module Gimme
|
|
41
58
|
it_behaves_like "it spies on class methods" do
|
42
59
|
subject { SpiesOnClassMethod.new(ChairFactory) }
|
43
60
|
Given { subject.spy(:build) }
|
61
|
+
Given { subject.spy(:inherited_build) }
|
44
62
|
Given { subject.raises_no_method_error = false }
|
45
63
|
Given { subject.spy(:fantasy) }
|
46
64
|
end
|
@@ -49,10 +67,11 @@ module Gimme
|
|
49
67
|
context "gimme DSL" do
|
50
68
|
it_behaves_like "it spies on class methods" do
|
51
69
|
Given { spy_on(ChairFactory, :build) }
|
70
|
+
Given { spy_on(ChairFactory, :inherited_build) }
|
52
71
|
Given { spy_on!(ChairFactory, :fantasy) }
|
53
72
|
end
|
54
73
|
end
|
55
74
|
|
56
75
|
|
57
76
|
end
|
58
|
-
end
|
77
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -330,6 +330,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
330
|
- - ! '>='
|
331
331
|
- !ruby/object:Gem::Version
|
332
332
|
version: '0'
|
333
|
+
segments:
|
334
|
+
- 0
|
335
|
+
hash: -660060900159398141
|
333
336
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
334
337
|
none: false
|
335
338
|
requirements:
|