mocha-protest-integration 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/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.md +27 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/lib/mocha-protest-integration.rb +56 -0
- data/mocha-protest-integration.gemspec +57 -0
- data/test/helper.rb +9 -0
- data/test/test_mocha-protest-integration.rb +7 -0
- metadata +85 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Elliot Winkler
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# mocha-protest-integration
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
|
5
|
+
Lets you use [Mocha](http://mocha.rubyforge.org) with [Protest](http://github.com/foca/protest).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Assuming you have Mocha and Protest installed, just run:
|
10
|
+
|
11
|
+
gem install mocha-protest-integration
|
12
|
+
|
13
|
+
Then, in your test helper, after you've required mocha and protest, just say:
|
14
|
+
|
15
|
+
require 'mocha-protest-integration'
|
16
|
+
|
17
|
+
## Support
|
18
|
+
|
19
|
+
If you find any bugs with this gem, feel free to:
|
20
|
+
|
21
|
+
* file a bug report in the [Issues area on Github](http://github.com/mcmire/mocha-protest-integration/issues)
|
22
|
+
* fork the [project on Github](http://github.com/mcmire/mocha-protest-integration) and send me a pull request
|
23
|
+
* email me (*firstname* dot *lastname* at gmail dot com)
|
24
|
+
|
25
|
+
## Author/License
|
26
|
+
|
27
|
+
(c) 2010 Elliot Winkler. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "mocha-protest-integration"
|
8
|
+
gem.summary = %Q{Lets you use Mocha with Protest.}
|
9
|
+
gem.description = %Q{Lets you use Mocha with Protest.}
|
10
|
+
gem.email = "elliot.winkler@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/mcmire/mocha-protest-integration"
|
12
|
+
gem.authors = ["Elliot Winkler"]
|
13
|
+
gem.add_dependency "protest", "~> 0.2.3"
|
14
|
+
gem.add_dependency "mcmire-mocha", "~> 0.9.8"
|
15
|
+
#gem.add_development_dependency "yard", ">= 0"
|
16
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'rake/testtask'
|
24
|
+
Rake::TestTask.new(:test) do |test|
|
25
|
+
test.libs << 'lib' << 'test'
|
26
|
+
test.pattern = 'test/**/test_*.rb'
|
27
|
+
test.verbose = true
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
require 'rcov/rcovtask'
|
32
|
+
Rcov::RcovTask.new do |test|
|
33
|
+
test.libs << 'test'
|
34
|
+
test.pattern = 'test/**/test_*.rb'
|
35
|
+
test.verbose = true
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
task :rcov do
|
39
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
task :test => :check_dependencies
|
44
|
+
|
45
|
+
task :default => :test
|
46
|
+
|
47
|
+
begin
|
48
|
+
require 'yard'
|
49
|
+
YARD::Rake::YardocTask.new
|
50
|
+
rescue LoadError
|
51
|
+
task :yardoc do
|
52
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
53
|
+
end
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Mocha
|
2
|
+
module Integration
|
3
|
+
module Protest
|
4
|
+
class AssertionCounter
|
5
|
+
def initialize(report)
|
6
|
+
@report = report
|
7
|
+
end
|
8
|
+
def increment
|
9
|
+
@report.add_assertion
|
10
|
+
end
|
11
|
+
end
|
12
|
+
module TestCase
|
13
|
+
def run(report)
|
14
|
+
assertion_counter = AssertionCounter.new(report) # mocha
|
15
|
+
@report = report
|
16
|
+
pending if test.nil?
|
17
|
+
setup
|
18
|
+
instance_eval(&test)
|
19
|
+
mocha_verify(assertion_counter) # mocha
|
20
|
+
teardown
|
21
|
+
@report = nil
|
22
|
+
ensure
|
23
|
+
mocha_teardown # mocha
|
24
|
+
end
|
25
|
+
end
|
26
|
+
module Runner
|
27
|
+
def report(test, running_global_setup_or_teardown=false)
|
28
|
+
@report.on_test(::Protest::Test.new(test)) if @report.respond_to?(:on_test) && !running_global_setup_or_teardown
|
29
|
+
test.run(@report)
|
30
|
+
@report.on_pass(::Protest::PassedTest.new(test)) unless running_global_setup_or_teardown
|
31
|
+
rescue Mocha::ExpectationError => e # mocha
|
32
|
+
@report.on_failure(::Protest::FailedTest.new(test, e)) # mocha
|
33
|
+
rescue ::Protest::Pending => e
|
34
|
+
@report.on_pending(::Protest::PendingTest.new(test, e))
|
35
|
+
rescue ::Protest::AssertionFailed => e
|
36
|
+
@report.on_failure(::Protest::FailedTest.new(test, e))
|
37
|
+
rescue ::Exception => e
|
38
|
+
@report.on_error(::Protest::ErroredTest.new(test, e))
|
39
|
+
raise if running_global_setup_or_teardown
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Protest::TestCase.class_eval do
|
47
|
+
include Mocha::API
|
48
|
+
alias_method :__run_before_mocha, :run
|
49
|
+
remove_method :run
|
50
|
+
include Mocha::Integration::Protest::TestCase
|
51
|
+
end
|
52
|
+
Protest::Runner.class_eval do
|
53
|
+
alias_method :__report_before_mocha, :report
|
54
|
+
remove_method :report
|
55
|
+
include Mocha::Integration::Protest::Runner
|
56
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{mocha-protest-integration}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Elliot Winkler"]
|
12
|
+
s.date = %q{2010-01-08}
|
13
|
+
s.description = %q{Lets you use Mocha with Protest.}
|
14
|
+
s.email = %q{elliot.winkler@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/mocha-protest-integration.rb",
|
27
|
+
"mocha-protest-integration.gemspec",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_mocha-protest-integration.rb"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/mcmire/mocha-protest-integration}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.5}
|
35
|
+
s.summary = %q{Lets you use Mocha with Protest.}
|
36
|
+
s.test_files = [
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_mocha-protest-integration.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<protest>, ["~> 0.2.3"])
|
47
|
+
s.add_runtime_dependency(%q<mcmire-mocha>, ["~> 0.9.8"])
|
48
|
+
else
|
49
|
+
s.add_dependency(%q<protest>, ["~> 0.2.3"])
|
50
|
+
s.add_dependency(%q<mcmire-mocha>, ["~> 0.9.8"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<protest>, ["~> 0.2.3"])
|
54
|
+
s.add_dependency(%q<mcmire-mocha>, ["~> 0.9.8"])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
data/test/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mocha-protest-integration
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elliot Winkler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-08 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: protest
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.2.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mcmire-mocha
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.8
|
34
|
+
version:
|
35
|
+
description: Lets you use Mocha with Protest.
|
36
|
+
email: elliot.winkler@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.md
|
44
|
+
files:
|
45
|
+
- .document
|
46
|
+
- .gitignore
|
47
|
+
- LICENSE
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
50
|
+
- VERSION
|
51
|
+
- lib/mocha-protest-integration.rb
|
52
|
+
- mocha-protest-integration.gemspec
|
53
|
+
- test/helper.rb
|
54
|
+
- test/test_mocha-protest-integration.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://github.com/mcmire/mocha-protest-integration
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options:
|
61
|
+
- --charset=UTF-8
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.3.5
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Lets you use Mocha with Protest.
|
83
|
+
test_files:
|
84
|
+
- test/helper.rb
|
85
|
+
- test/test_mocha-protest-integration.rb
|