must_be 1.0.3 → 1.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.
- checksums.yaml +7 -0
- data/ChangeLog.md +5 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +22 -0
- data/README.md +14 -14
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/doc/readme/examples.rb +13 -13
- data/lib/must_be.rb +2 -2
- data/lib/must_be/attr_typed.rb +1 -1
- data/lib/must_be/core.rb +1 -0
- data/must_be.gemspec +46 -57
- data/spec/must_be/attr_typed_spec.rb +14 -14
- data/spec/must_be/basic_spec.rb +22 -22
- data/spec/must_be/containers_spec.rb +10 -10
- data/spec/must_be/core_spec.rb +32 -22
- data/spec/must_be/nonstandard_control_flow_spec.rb +73 -71
- data/spec/must_be/proxy_spec.rb +13 -13
- data/spec/notify_matcher_spec.rb +1 -1
- data/spec/spec_helper.rb +11 -3
- data/spec/typical_usage_spec.rb +5 -5
- metadata +52 -81
- data/.gitignore +0 -2
data/spec/must_be/proxy_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe MustBe do
|
|
10
10
|
it "should raise ArgumentError" do
|
11
11
|
expect do
|
12
12
|
Proxy.new(:moxie, :must_could)
|
13
|
-
end.
|
13
|
+
end.to raise_error(ArgumentError,
|
14
14
|
"assertion (:must_could) must be :must or :must_not")
|
15
15
|
end
|
16
16
|
end
|
@@ -95,16 +95,16 @@ describe MustBe do
|
|
95
95
|
subject.between?(-4, 4)
|
96
96
|
end
|
97
97
|
|
98
|
-
it_should_notify("230579.must.respond_to?(:
|
99
|
-
subject.respond_to? :
|
98
|
+
it_should_notify("230579.must.respond_to?(:nan?)") do
|
99
|
+
subject.respond_to? :nan?
|
100
100
|
end
|
101
101
|
|
102
|
-
it_should_not_notify("230579.must.instance_of?(
|
103
|
-
subject.instance_of?
|
102
|
+
it_should_not_notify("230579.must.instance_of?(Integer)") do
|
103
|
+
subject.instance_of? Integer
|
104
104
|
end
|
105
105
|
|
106
|
-
it_should_notify("230579.must.instance_of?(
|
107
|
-
subject.instance_of?
|
106
|
+
it_should_notify("230579.must.instance_of?(Float)") do
|
107
|
+
subject.instance_of? Float
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should have a different #object_id" do
|
@@ -176,17 +176,17 @@ describe MustBe do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it_should_not_notify(
|
179
|
-
"230579.must_not.respond_to?(:
|
180
|
-
subject.respond_to? :
|
179
|
+
"230579.must_not.respond_to?(:nan?)") do
|
180
|
+
subject.respond_to? :nan?
|
181
181
|
end
|
182
182
|
|
183
|
-
it_should_notify("230579.must_not.instance_of?(
|
184
|
-
subject.instance_of?
|
183
|
+
it_should_notify("230579.must_not.instance_of?(Integer)") do
|
184
|
+
subject.instance_of? Integer
|
185
185
|
end
|
186
186
|
|
187
187
|
it_should_not_notify(
|
188
|
-
"230579.must_not.instance_of?(
|
189
|
-
subject.instance_of?
|
188
|
+
"230579.must_not.instance_of?(Float)") do
|
189
|
+
subject.instance_of? Float
|
190
190
|
end
|
191
191
|
end
|
192
192
|
end
|
data/spec/notify_matcher_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -55,7 +55,15 @@ end
|
|
55
55
|
|
56
56
|
### MustBeExampleHelper ###
|
57
57
|
|
58
|
-
require 'rspec'
|
58
|
+
require 'rspec/its'
|
59
|
+
|
60
|
+
# Some old syntax.
|
61
|
+
RSpec.configure do |config|
|
62
|
+
config.expect_with(:rspec){|c| c.syntax = [:should, :expect]}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Some old semantics.
|
66
|
+
RSpec::Expectations.configuration.on_potential_false_positives = :nothing
|
59
67
|
|
60
68
|
module MustBeExampleHelper
|
61
69
|
|
@@ -189,11 +197,11 @@ module MustBeExampleHelper
|
|
189
197
|
end
|
190
198
|
end
|
191
199
|
|
192
|
-
|
200
|
+
failure_message do |given|
|
193
201
|
@message
|
194
202
|
end
|
195
203
|
|
196
|
-
|
204
|
+
failure_message_when_negated do |given|
|
197
205
|
@message
|
198
206
|
end
|
199
207
|
end
|
data/spec/typical_usage_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe MustBe, " typical usage" do
|
|
8
8
|
context "when called with a Class, it notifies unless"\
|
9
9
|
" receiver.is_a? Class" do
|
10
10
|
notify_example %{4.must_be(Numeric)}
|
11
|
-
notify_example %{4.must_be(Float)},
|
11
|
+
notify_example %{4.must_be(Float)}, Integer
|
12
12
|
end
|
13
13
|
|
14
14
|
context "when called with a regexp, it notifies unless"\
|
@@ -20,13 +20,13 @@ describe MustBe, " typical usage" do
|
|
20
20
|
context "when called with a range, it notifies unless"\
|
21
21
|
" range.include? receiver" do
|
22
22
|
notify_example %{5.must_be(1..5)}
|
23
|
-
notify_example %{5.must_be(1...5)},
|
23
|
+
notify_example %{5.must_be(1...5)}, Integer
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when called with an array, it notifies unless"\
|
27
27
|
" array == receiver" do
|
28
28
|
notify_example %{[3, 5].must_be([3, 5])}
|
29
|
-
notify_example %{3.must_be([3, 5])},
|
29
|
+
notify_example %{3.must_be([3, 5])}, Integer
|
30
30
|
end
|
31
31
|
|
32
32
|
context "when called with a proc, it notifies unless proc[receiver]" do
|
@@ -50,7 +50,7 @@ describe MustBe, " typical usage" do
|
|
50
50
|
context "when called with multiple arguments, it notifies unless"\
|
51
51
|
" receiver case-equals (===) one of them" do
|
52
52
|
notify_example %{:happy.must_be(String, Symbol)}
|
53
|
-
notify_example %{934.must_be(String, Symbol)},
|
53
|
+
notify_example %{934.must_be(String, Symbol)}, Integer
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -169,7 +169,7 @@ describe MustBe, " typical usage" do
|
|
169
169
|
end) do |note|
|
170
170
|
did_call_block = true
|
171
171
|
end
|
172
|
-
did_call_block.should
|
172
|
+
did_call_block.should be false
|
173
173
|
end
|
174
174
|
end
|
175
175
|
end
|
metadata
CHANGED
@@ -1,65 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: must_be
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 1.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- William Taysom
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 4
|
33
|
-
version: "1.4"
|
11
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec-its
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
34
20
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
49
34
|
type: :development
|
50
|
-
|
51
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
41
|
+
description: must_be provides runtime assertions which can easily be disabled in production
|
42
|
+
environments. Likewise, the notifier can be customized to raise errors, log failure,
|
43
|
+
enter the debugger, or anything else.
|
52
44
|
email: wtaysom@gmail.com
|
53
45
|
executables: []
|
54
|
-
|
55
46
|
extensions: []
|
56
|
-
|
57
|
-
extra_rdoc_files:
|
47
|
+
extra_rdoc_files:
|
58
48
|
- ChangeLog.md
|
59
49
|
- README.md
|
60
|
-
files:
|
61
|
-
- .gitignore
|
50
|
+
files:
|
62
51
|
- ChangeLog.md
|
52
|
+
- Gemfile
|
53
|
+
- Gemfile.lock
|
63
54
|
- README.md
|
64
55
|
- Rakefile
|
65
56
|
- VERSION
|
@@ -83,47 +74,27 @@ files:
|
|
83
74
|
- spec/notify_matcher_spec.rb
|
84
75
|
- spec/spec_helper.rb
|
85
76
|
- spec/typical_usage_spec.rb
|
86
|
-
has_rdoc: true
|
87
77
|
homepage: http://github.com/wtaysom/must_be
|
88
78
|
licenses: []
|
89
|
-
|
79
|
+
metadata: {}
|
90
80
|
post_install_message:
|
91
|
-
rdoc_options:
|
92
|
-
|
93
|
-
require_paths:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
94
83
|
- lib
|
95
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
-
|
97
|
-
requirements:
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
98
86
|
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
version: "0"
|
104
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
107
91
|
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
segments:
|
111
|
-
- 0
|
112
|
-
version: "0"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
113
94
|
requirements: []
|
114
|
-
|
115
95
|
rubyforge_project:
|
116
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.7.3
|
117
97
|
signing_key:
|
118
|
-
specification_version:
|
98
|
+
specification_version: 4
|
119
99
|
summary: must_be Runtime Assertions
|
120
|
-
test_files:
|
121
|
-
- spec/must_be/attr_typed_spec.rb
|
122
|
-
- spec/must_be/basic_spec.rb
|
123
|
-
- spec/must_be/containers_spec.rb
|
124
|
-
- spec/must_be/core_spec.rb
|
125
|
-
- spec/must_be/nonstandard_control_flow_spec.rb
|
126
|
-
- spec/must_be/proxy_spec.rb
|
127
|
-
- spec/notify_matcher_spec.rb
|
128
|
-
- spec/spec_helper.rb
|
129
|
-
- spec/typical_usage_spec.rb
|
100
|
+
test_files: []
|
data/.gitignore
DELETED