flexmock 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/flexmock/mock_container.rb +1 -1
- data/lib/flexmock/version.rb +1 -1
- data/test/base_class_test.rb +9 -0
- metadata +31 -26
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
FlexMock is a simple, but flexible, mock object library for Ruby unit
|
4
4
|
testing.
|
5
5
|
|
6
|
-
Version :: 1.0.
|
6
|
+
Version :: 1.0.2
|
7
7
|
|
8
8
|
= Links
|
9
9
|
|
@@ -139,7 +139,7 @@ FlexMock::MockContainer#flexmock for more details.
|
|
139
139
|
This defines a mock that is based on the User class (the class is
|
140
140
|
called the mock's "base class"). Mocks with base classes prevent you
|
141
141
|
from mocking or stubbing methods that are not instance methods of
|
142
|
-
|
142
|
+
the base class. This helps prevent tests from becoming stale with
|
143
143
|
incorrectly mocked objects when the method names change.
|
144
144
|
|
145
145
|
Use the <code>explicitly</code> modifier to
|
@@ -159,11 +159,11 @@ class FlexMock
|
|
159
159
|
mock ||= FlexMock.new(name || "unknown", self)
|
160
160
|
result = mock
|
161
161
|
end
|
162
|
+
mock.flexmock_based_on(base_class) if base_class
|
162
163
|
mock.should_receive(quick_defs)
|
163
164
|
yield(mock) if block_given?
|
164
165
|
flexmock_remember(mock)
|
165
166
|
ContainerHelper.add_model_methods(mock, model_class, id) if model_class
|
166
|
-
mock.flexmock_based_on(base_class) if base_class
|
167
167
|
result
|
168
168
|
end
|
169
169
|
alias flexstub flexmock
|
data/lib/flexmock/version.rb
CHANGED
data/test/base_class_test.rb
CHANGED
@@ -39,6 +39,15 @@ class BaseClassTest < Test::Unit::TestCase
|
|
39
39
|
assert_match(/method:.+baz/i, ex.message)
|
40
40
|
end
|
41
41
|
|
42
|
+
def test_can_not_stub_non_class_methods_in_single_line
|
43
|
+
ex = assert_raises(NoMethodError) do
|
44
|
+
m = flexmock(:on, FooBar, :bark => :value)
|
45
|
+
end
|
46
|
+
assert_match(/can *not stub methods.*base.*class/i, ex.message)
|
47
|
+
assert_match(/class:.+FooBar/i, ex.message)
|
48
|
+
assert_match(/method:.+bark/i, ex.message)
|
49
|
+
end
|
50
|
+
|
42
51
|
def test_can_explicitly_stub_non_class_defined_methods
|
43
52
|
mock.should_receive(:baz).explicitly.and_return(:bar)
|
44
53
|
assert_equal :bar, mock.baz
|
metadata
CHANGED
@@ -1,25 +1,29 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexmock
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 1.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Jim Weirich
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
12
|
+
|
13
|
+
date: 2012-09-08 00:00:00 Z
|
13
14
|
dependencies: []
|
14
|
-
|
15
|
-
|
16
|
-
simple, it is very flexible.\n "
|
15
|
+
|
16
|
+
description: "\n FlexMock is a extremely simple mock object class compatible\n with the Test::Unit framework. Although the FlexMock's\n interface is simple, it is very flexible.\n "
|
17
17
|
email: jim.weirich@gmail.com
|
18
18
|
executables: []
|
19
|
+
|
19
20
|
extensions: []
|
20
|
-
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
21
23
|
- README.rdoc
|
22
24
|
- CHANGES
|
25
|
+
- doc/examples/rspec_examples_spec.rdoc
|
26
|
+
- doc/examples/test_unit_examples_test.rdoc
|
23
27
|
- doc/GoogleExample.rdoc
|
24
28
|
- doc/releases/flexmock-0.4.0.rdoc
|
25
29
|
- doc/releases/flexmock-0.4.1.rdoc
|
@@ -41,9 +45,7 @@ extra_rdoc_files:
|
|
41
45
|
- doc/releases/flexmock-0.8.5.rdoc
|
42
46
|
- doc/releases/flexmock-0.9.0.rdoc
|
43
47
|
- doc/releases/flexmock-1.0.0.rdoc
|
44
|
-
|
45
|
-
- doc/examples/test_unit_examples_test.rdoc
|
46
|
-
files:
|
48
|
+
files:
|
47
49
|
- CHANGES
|
48
50
|
- Gemfile
|
49
51
|
- Gemfile.lock
|
@@ -114,6 +116,8 @@ files:
|
|
114
116
|
- test/undefined_test.rb
|
115
117
|
- flexmock.blurb
|
116
118
|
- install.rb
|
119
|
+
- doc/examples/rspec_examples_spec.rdoc
|
120
|
+
- doc/examples/test_unit_examples_test.rdoc
|
117
121
|
- doc/GoogleExample.rdoc
|
118
122
|
- doc/releases/flexmock-0.4.0.rdoc
|
119
123
|
- doc/releases/flexmock-0.4.1.rdoc
|
@@ -135,35 +139,36 @@ files:
|
|
135
139
|
- doc/releases/flexmock-0.8.5.rdoc
|
136
140
|
- doc/releases/flexmock-0.9.0.rdoc
|
137
141
|
- doc/releases/flexmock-1.0.0.rdoc
|
138
|
-
- doc/examples/rspec_examples_spec.rdoc
|
139
|
-
- doc/examples/test_unit_examples_test.rdoc
|
140
142
|
homepage: https://github.com/jimweirich/flexmock
|
141
143
|
licenses: []
|
144
|
+
|
142
145
|
post_install_message:
|
143
|
-
rdoc_options:
|
146
|
+
rdoc_options:
|
144
147
|
- --title
|
145
148
|
- FlexMock
|
146
149
|
- --main
|
147
150
|
- README.rdoc
|
148
151
|
- --line-numbers
|
149
|
-
require_paths:
|
152
|
+
require_paths:
|
150
153
|
- lib
|
151
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
155
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version:
|
157
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: "0"
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
161
|
none: false
|
159
|
-
requirements:
|
160
|
-
- -
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version:
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: "0"
|
163
166
|
requirements: []
|
167
|
+
|
164
168
|
rubyforge_project:
|
165
169
|
rubygems_version: 1.8.15
|
166
170
|
signing_key:
|
167
171
|
specification_version: 3
|
168
172
|
summary: Simple and Flexible Mock Objects for Testing
|
169
173
|
test_files: []
|
174
|
+
|