bogus 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -3
- data/bogus.gemspec +1 -3
- data/features/authors.md +2 -1
- data/lib/bogus/fakes/method_stringifier.rb +2 -2
- data/lib/bogus/minitest/syntax.rb +2 -2
- data/lib/bogus/minitest.rb +2 -2
- data/lib/bogus/stubbing/verifies_stub_definition.rb +10 -1
- data/lib/bogus/version.rb +1 -1
- data/license.md +1 -0
- data/spec/bogus/fakes/fake_configuration_spec.rb +1 -1
- data/spec/bogus/stubbing/double_spec.rb +1 -1
- data/spec/bogus/stubbing/verifies_stub_definition_spec.rb +14 -1
- data/spec/spec_helper.rb +2 -2
- metadata +5 -6
- data/license.md +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f19fb1ce0b29dead39cdc4fefdd2fb496abafbfc2fe1ce958f31a6dcf91cf708
|
4
|
+
data.tar.gz: 3694b31fbc3f9211de7e309d72042abd98e35fc5c63cb4fb32dce87484d7fde3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e324b7b0f9e4c1a8c5403de4d6ccd3a9a1e694a72d63a88af4c27819c59d3cd0c26e6ca22de87a304853b2c0189902a764efc543d6493c12a60a0ba262e5c737
|
7
|
+
data.tar.gz: d7489aa2eb177b1fd20409b808ad16f1b37183bfc226b56ce15ce3126472dc3e47a87a8c7724faf9daf910b789c96184c5925d86274b72314f9791a62d265c84
|
data/.travis.yml
CHANGED
data/bogus.gemspec
CHANGED
@@ -12,8 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{Create fakes to make your isolated unit tests reliable.}
|
13
13
|
s.description = %q{Decreases the need to write integration tests by ensuring that the things you stub or mock actually exist.}
|
14
14
|
|
15
|
-
s.rubyforge_project = "bogus"
|
16
|
-
|
17
15
|
s.files = `git ls-files`.split("\n")
|
18
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -36,7 +34,7 @@ Gem::Specification.new do |s|
|
|
36
34
|
s.add_development_dependency 'coveralls'
|
37
35
|
s.add_development_dependency 'wwtd'
|
38
36
|
|
39
|
-
s.add_development_dependency 'activerecord', '>= 3', '<
|
37
|
+
s.add_development_dependency 'activerecord', '>= 3', '< 7'
|
40
38
|
s.add_development_dependency 'activerecord-nulldb-adapter'
|
41
39
|
|
42
40
|
s.add_development_dependency 'minitest', '>= 4.7'
|
data/features/authors.md
CHANGED
@@ -29,9 +29,10 @@ The mocking DSL syntax was inspired by the [RR framework][rr].
|
|
29
29
|
|
30
30
|
## Sponsor
|
31
31
|
|
32
|
-
The development of Bogus was partially sponsored by [Lunar Logic][llp].
|
32
|
+
The development of Bogus was partially sponsored by [GunpowderLabs][gunpowderlabs] and [Lunar Logic][llp].
|
33
33
|
|
34
34
|
[llp]: http://www.lunarlogicpolska.com
|
35
|
+
[gunpowderlabs]: http://www.gunpowderlabs.com
|
35
36
|
|
36
37
|
[psyho]: https://github.com/psyho
|
37
38
|
[apohorecki]: http://twitter.com/apohorecki
|
@@ -27,12 +27,12 @@ module Bogus
|
|
27
27
|
|
28
28
|
def argument_to_string(name, type, default)
|
29
29
|
case type
|
30
|
-
when :block then "&#{name}"
|
30
|
+
when :block then "&#{name == :& ? 'block' : name}"
|
31
31
|
when :key then default ? "#{name}: #{default}" : "#{name}: #{name}"
|
32
32
|
when :keyreq then default ? "#{name}:" : "#{name}: #{name}"
|
33
33
|
when :opt then default ? "#{name} = #{default}" : name
|
34
34
|
when :req then name
|
35
|
-
when :rest then "*#{name}"
|
35
|
+
when :rest then "*#{name == :* ? 'rest' : name}"
|
36
36
|
when :keyrest then "**#{name}"
|
37
37
|
else raise "unknown argument type: #{type}"
|
38
38
|
end
|
data/lib/bogus/minitest.rb
CHANGED
@@ -8,12 +8,17 @@ module Bogus
|
|
8
8
|
stubbing_non_existent_method!(object, method_name) unless object.respond_to?(method_name)
|
9
9
|
return unless object.methods.include?(method_name)
|
10
10
|
return if WithArguments.with_matcher?(args)
|
11
|
-
method = object
|
11
|
+
method = get_method_object(object, method_name)
|
12
12
|
verify_call!(method, args)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
+
def get_method_object(object, method_name)
|
18
|
+
return object.instance_method(:initialize) if constructor?(object, method_name)
|
19
|
+
object.method(method_name)
|
20
|
+
end
|
21
|
+
|
17
22
|
def verify_call!(method, args)
|
18
23
|
object = Object.new
|
19
24
|
fake_method = method_stringifier.stringify(method, "")
|
@@ -31,5 +36,9 @@ module Bogus
|
|
31
36
|
def stubbing_non_existent_method!(object, method_name)
|
32
37
|
raise NameError, "#{object.inspect} does not respond to #{method_name}"
|
33
38
|
end
|
39
|
+
|
40
|
+
def constructor?(object, method_name)
|
41
|
+
method_name.to_sym == :new && object.kind_of?(Class)
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
data/lib/bogus/version.rb
CHANGED
data/license.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
features/license.md
|
@@ -2,6 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bogus::VerifiesStubDefinition do
|
4
4
|
class ExampleForVerify
|
5
|
+
def initialize(test)
|
6
|
+
end
|
7
|
+
|
5
8
|
def foo(bar)
|
6
9
|
end
|
7
10
|
|
@@ -15,7 +18,7 @@ describe Bogus::VerifiesStubDefinition do
|
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
18
|
-
let(:object) { ExampleForVerify.new }
|
21
|
+
let(:object) { ExampleForVerify.new(1) }
|
19
22
|
let(:verifies_stub_definition) { Bogus::VerifiesStubDefinition.new(method_stringifier) }
|
20
23
|
let(:method_stringifier) { isolate(Bogus::MethodStringifier) }
|
21
24
|
|
@@ -47,6 +50,16 @@ describe Bogus::VerifiesStubDefinition do
|
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
53
|
+
context "when checking #new" do
|
54
|
+
let(:object) { ExampleForVerify }
|
55
|
+
it "checks arity" do
|
56
|
+
it_allows(:new, [1])
|
57
|
+
end
|
58
|
+
it "errors with the wrong number of arguments" do
|
59
|
+
it_disallows(:new, [])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
50
63
|
it "checks for method presence" do
|
51
64
|
it_disallows(:bar, [1], NameError)
|
52
65
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
begin
|
3
3
|
require "coveralls"
|
4
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
5
5
|
SimpleCov::Formatter::HTMLFormatter,
|
6
|
-
Coveralls::SimpleCov::Formatter]
|
6
|
+
Coveralls::SimpleCov::Formatter])
|
7
7
|
rescue LoadError
|
8
8
|
warn "warning: coveralls gem not found; skipping Coveralls"
|
9
9
|
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bogus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Pohorecki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependor
|
@@ -215,7 +215,7 @@ dependencies:
|
|
215
215
|
version: '3'
|
216
216
|
- - "<"
|
217
217
|
- !ruby/object:Gem::Version
|
218
|
-
version: '
|
218
|
+
version: '7'
|
219
219
|
type: :development
|
220
220
|
prerelease: false
|
221
221
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -225,7 +225,7 @@ dependencies:
|
|
225
225
|
version: '3'
|
226
226
|
- - "<"
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version: '
|
228
|
+
version: '7'
|
229
229
|
- !ruby/object:Gem::Dependency
|
230
230
|
name: activerecord-nulldb-adapter
|
231
231
|
requirement: !ruby/object:Gem::Requirement
|
@@ -462,8 +462,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
462
462
|
- !ruby/object:Gem::Version
|
463
463
|
version: '0'
|
464
464
|
requirements: []
|
465
|
-
|
466
|
-
rubygems_version: 2.2.2
|
465
|
+
rubygems_version: 3.4.10
|
467
466
|
signing_key:
|
468
467
|
specification_version: 4
|
469
468
|
summary: Create fakes to make your isolated unit tests reliable.
|
data/license.md
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2012-2013 Adam Pohorecki
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|