assert-mocha 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/Gemfile +6 -0
- data/README.markdown +60 -0
- data/Rakefile +5 -0
- data/assert-mocha.gemspec +20 -0
- data/lib/assert-mocha.rb +12 -0
- data/lib/assert-mocha/version.rb +5 -0
- data/test/helper.rb +5 -0
- data/test/unit/assert-mocha_test.rb +20 -0
- metadata +109 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Assert-Mocha
|
2
|
+
|
3
|
+
The [assert](https://github.com/teaminsight/assert) gem with [mocha](https://github.com/floehopper/mocha). This gem just mixes in the Mocha API into the Assert context, giving you all the power of Mocha while using Assert.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
In your Gemfile add:
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem 'assert-mocha'
|
11
|
+
end
|
12
|
+
|
13
|
+
Then run `bundle install` to install the gem.
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Use assert as you normally would. Inherit from a context and use mocha's methods in your tests:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class BaseTest < Asset::Context
|
21
|
+
desc "some test"
|
22
|
+
setup do
|
23
|
+
@user = mock()
|
24
|
+
@user.expects(:some_method).once
|
25
|
+
@user.stubs(:name).returns("Someone")
|
26
|
+
end
|
27
|
+
subject{ @user }
|
28
|
+
|
29
|
+
should have_instance_methods :name
|
30
|
+
|
31
|
+
should "call the expected method" do
|
32
|
+
assert_nothing_raised{ subject.another_method } # assuming another_method calls #some_method
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
Copyright (c) 2011 Kelly Redding, Collin Redding, and Team Insight
|
40
|
+
|
41
|
+
Permission is hereby granted, free of charge, to any person
|
42
|
+
obtaining a copy of this software and associated documentation
|
43
|
+
files (the "Software"), to deal in the Software without
|
44
|
+
restriction, including without limitation the rights to use,
|
45
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
46
|
+
copies of the Software, and to permit persons to whom the
|
47
|
+
Software is furnished to do so, subject to the following
|
48
|
+
conditions:
|
49
|
+
|
50
|
+
The above copyright notice and this permission notice shall be
|
51
|
+
included in all copies or substantial portions of the Software.
|
52
|
+
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
54
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
55
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
56
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
57
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
58
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
59
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
60
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/assert-mocha/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Kelly Redding", "Collin Redding"]
|
6
|
+
gem.email = ["kelly@kelredd.com"]
|
7
|
+
gem.description = %q{Assert with Mocha}
|
8
|
+
gem.summary = %q{Assert with Mocha}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "assert-mocha"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Assert::Mocha::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency("assert", ["~>0.6.0"])
|
19
|
+
gem.add_dependency("mocha", ["~>0.10.0"])
|
20
|
+
end
|
data/lib/assert-mocha.rb
ADDED
data/test/helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'assert'
|
2
|
+
|
3
|
+
module Assert::Mocha
|
4
|
+
|
5
|
+
class BaseTest < Assert::Context
|
6
|
+
desc "Assert::Context"
|
7
|
+
setup do
|
8
|
+
@class = Assert::Context
|
9
|
+
@instance = Assert::Context.new
|
10
|
+
end
|
11
|
+
subject{ @instance }
|
12
|
+
|
13
|
+
should have_instance_methods :mock, :stub
|
14
|
+
|
15
|
+
should "include the Mocha::API" do
|
16
|
+
assert_includes Mocha::API, @class.included_modules
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: assert-mocha
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Kelly Redding
|
14
|
+
- Collin Redding
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-10-05 00:00:00 -05:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: assert
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 6
|
33
|
+
- 0
|
34
|
+
version: 0.6.0
|
35
|
+
prerelease: false
|
36
|
+
type: :runtime
|
37
|
+
requirement: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: mocha
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 55
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 10
|
49
|
+
- 0
|
50
|
+
version: 0.10.0
|
51
|
+
prerelease: false
|
52
|
+
type: :runtime
|
53
|
+
requirement: *id002
|
54
|
+
description: Assert with Mocha
|
55
|
+
email:
|
56
|
+
- kelly@kelredd.com
|
57
|
+
executables: []
|
58
|
+
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files: []
|
62
|
+
|
63
|
+
files:
|
64
|
+
- .gitignore
|
65
|
+
- Gemfile
|
66
|
+
- README.markdown
|
67
|
+
- Rakefile
|
68
|
+
- assert-mocha.gemspec
|
69
|
+
- lib/assert-mocha.rb
|
70
|
+
- lib/assert-mocha/version.rb
|
71
|
+
- test/helper.rb
|
72
|
+
- test/unit/assert-mocha_test.rb
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: ""
|
75
|
+
licenses: []
|
76
|
+
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
requirements: []
|
101
|
+
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.6.2
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: Assert with Mocha
|
107
|
+
test_files:
|
108
|
+
- test/helper.rb
|
109
|
+
- test/unit/assert-mocha_test.rb
|