assert-mocha 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in assert-mocha.gemspec
4
+ gemspec
5
+
6
+ gem 'rake', '~>0.9.2'
@@ -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.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require 'assert/rake_tasks'
5
+ Assert::RakeTasks.for :test
@@ -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
@@ -0,0 +1,12 @@
1
+ require 'assert'
2
+ require 'mocha'
3
+
4
+ module Assert
5
+ module Mocha
6
+ autoload :VERSION, 'assert-mocha/version'
7
+ end
8
+ end
9
+
10
+ Assert::Context.class_eval do
11
+ include Mocha::API
12
+ end
@@ -0,0 +1,5 @@
1
+ module Assert
2
+ module Mocha
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ root_path = File.expand_path("../..", __FILE__)
2
+ if !$LOAD_PATH.include?(root_path)
3
+ $LOAD_PATH.unshift(root_path)
4
+ end
5
+ require 'assert-mocha'
@@ -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