flexmock-minitest 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/History.txt +14 -0
- data/Manifest.txt +6 -0
- data/README.txt +51 -0
- data/Rakefile +17 -0
- data/lib/flexmock/minitest.rb +31 -0
- data/test/test_flexmock_minitest.rb +43 -0
- metadata +100 -0
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
= flexmock-minitest
|
2
|
+
|
3
|
+
* https://github.com/phiggins/flexmock-minitest
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Some lame monkeypatches to make a small subset of FlexMock functionality work
|
8
|
+
with MiniTest::Unit and MiniTest::Spec.
|
9
|
+
|
10
|
+
== FEATURES/PROBLEMS:
|
11
|
+
|
12
|
+
* Basic flexmock stubbing and call counts work.
|
13
|
+
|
14
|
+
== SYNOPSIS:
|
15
|
+
|
16
|
+
* See test suite for basic usage.
|
17
|
+
|
18
|
+
== REQUIREMENTS:
|
19
|
+
|
20
|
+
* Tested with ruby 1.9.2 and nothing else.
|
21
|
+
* Lots of flexmock stuff probably doesn't work.
|
22
|
+
* Don't use this for any reason, ever.
|
23
|
+
|
24
|
+
== INSTALL:
|
25
|
+
|
26
|
+
* Nothing special.
|
27
|
+
|
28
|
+
== LICENSE:
|
29
|
+
|
30
|
+
(The MIT License)
|
31
|
+
|
32
|
+
Copyright (c) 2011 Pete Higgins
|
33
|
+
|
34
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
35
|
+
a copy of this software and associated documentation files (the
|
36
|
+
'Software'), to deal in the Software without restriction, including
|
37
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
38
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
39
|
+
permit persons to whom the Software is furnished to do so, subject to
|
40
|
+
the following conditions:
|
41
|
+
|
42
|
+
The above copyright notice and this permission notice shall be
|
43
|
+
included in all copies or substantial portions of the Software.
|
44
|
+
|
45
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
46
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
47
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
48
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
49
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
50
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
51
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require 'hoe/git'
|
6
|
+
|
7
|
+
Hoe.plugin(:git)
|
8
|
+
|
9
|
+
Hoe.spec 'flexmock-minitest' do
|
10
|
+
developer('pete higgins', 'pete@peterhiggins.org')
|
11
|
+
|
12
|
+
extra_dev_deps << ["hoe-git", "~> 1.3.0"]
|
13
|
+
extra_deps << ["flexmock", "~> 0.9.0"]
|
14
|
+
self.testlib = :minitest
|
15
|
+
end
|
16
|
+
|
17
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
require 'flexmock/base'
|
3
|
+
|
4
|
+
VERSION = "1.0.1"
|
5
|
+
|
6
|
+
class FlexMock
|
7
|
+
@framework_adapter = Module.new do
|
8
|
+
extend MiniTest::Assertions
|
9
|
+
|
10
|
+
def assertion_failed_error
|
11
|
+
MiniTest::Assertion
|
12
|
+
end
|
13
|
+
extend self
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
MiniTest::Unit::TestCase.class_eval do
|
18
|
+
include FlexMock::MockContainer
|
19
|
+
|
20
|
+
alias flexmock_minitest_teardown teardown
|
21
|
+
def teardown
|
22
|
+
flexmock_teardown
|
23
|
+
flexmock_minitest_teardown
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
MiniTest::Spec.class_eval do
|
28
|
+
after do
|
29
|
+
flexmock_teardown
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'flexmock/minitest'
|
2
|
+
|
3
|
+
class TestMock
|
4
|
+
def self.foo
|
5
|
+
42
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class TestFlexmockMinitest < MiniTest::Unit::TestCase
|
10
|
+
def test_flexmock_stubbing_works_with_minitest
|
11
|
+
flexmock(TestMock).should_receive(:foo => 43)
|
12
|
+
|
13
|
+
assert_equal 43, TestMock.foo
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_flexmock_expectations_work_with_minitest
|
17
|
+
flexmock(TestMock).should_receive(:foo).never
|
18
|
+
|
19
|
+
TestMock.foo
|
20
|
+
|
21
|
+
assert_raises MiniTest::Assertion do
|
22
|
+
flexmock_verify
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe MiniTest::Spec do
|
28
|
+
it "works with flexmock stubbing" do
|
29
|
+
flexmock(TestMock).should_receive(:foo => 43)
|
30
|
+
|
31
|
+
assert_equal 43, TestMock.foo
|
32
|
+
end
|
33
|
+
|
34
|
+
it "works with flexmock expectations" do
|
35
|
+
flexmock(TestMock).should_receive(:foo).never
|
36
|
+
|
37
|
+
TestMock.foo
|
38
|
+
|
39
|
+
assert_raises MiniTest::Assertion do
|
40
|
+
flexmock_verify
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flexmock-minitest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- pete higgins
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-19 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: flexmock
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.9.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hoe-git
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.3.0
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: hoe
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.9.1
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
description: |-
|
50
|
+
Some lame monkeypatches to make a small subset of FlexMock functionality work
|
51
|
+
with MiniTest::Unit and MiniTest::Spec.
|
52
|
+
email:
|
53
|
+
- pete@peterhiggins.org
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files:
|
59
|
+
- History.txt
|
60
|
+
- Manifest.txt
|
61
|
+
- README.txt
|
62
|
+
files:
|
63
|
+
- History.txt
|
64
|
+
- Manifest.txt
|
65
|
+
- README.txt
|
66
|
+
- Rakefile
|
67
|
+
- lib/flexmock/minitest.rb
|
68
|
+
- test/test_flexmock_minitest.rb
|
69
|
+
- .gemtest
|
70
|
+
has_rdoc: true
|
71
|
+
homepage: https://github.com/phiggins/flexmock-minitest
|
72
|
+
licenses: []
|
73
|
+
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options:
|
76
|
+
- --main
|
77
|
+
- README.txt
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
requirements: []
|
93
|
+
|
94
|
+
rubyforge_project: flexmock-minitest
|
95
|
+
rubygems_version: 1.5.2
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Some lame monkeypatches to make a small subset of FlexMock functionality work with MiniTest::Unit and MiniTest::Spec.
|
99
|
+
test_files:
|
100
|
+
- test/test_flexmock_minitest.rb
|