must 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/must/rule.rb +1 -1
- data/lib/must/version.rb +1 -1
- data/spec/duck_spec.rb +19 -0
- metadata +34 -50
data/lib/must/rule.rb
CHANGED
data/lib/must/version.rb
CHANGED
data/spec/duck_spec.rb
CHANGED
@@ -3,10 +3,16 @@ require 'spec_helper'
|
|
3
3
|
describe Must::Rule, "duck" do
|
4
4
|
class CFoo
|
5
5
|
def foo; 1; end
|
6
|
+
|
7
|
+
private
|
8
|
+
def pfoo; 2; end
|
6
9
|
end
|
7
10
|
|
8
11
|
module MFoo
|
9
12
|
def foo; 1; end
|
13
|
+
|
14
|
+
private
|
15
|
+
def pfoo; 2; end
|
10
16
|
end
|
11
17
|
|
12
18
|
describe "duck typing test" do
|
@@ -22,6 +28,10 @@ describe Must::Rule, "duck" do
|
|
22
28
|
MFoo.must.duck(:to_s ).should == MFoo
|
23
29
|
MFoo.must.duck("to_s" ).should == MFoo
|
24
30
|
MFoo.must.duck(".to_s").should == MFoo
|
31
|
+
|
32
|
+
foo = CFoo.new
|
33
|
+
foo.must.duck("foo").should == foo
|
34
|
+
foo.must.duck("pfoo").should == foo
|
25
35
|
end
|
26
36
|
|
27
37
|
specify "[NG]" do
|
@@ -50,11 +60,20 @@ describe Must::Rule, "duck" do
|
|
50
60
|
lambda { CFoo.must.duck("#bar") }.should raise_error(Must::Invalid)
|
51
61
|
lambda { MFoo.must.duck("#bar") }.should raise_error(Must::Invalid)
|
52
62
|
end
|
63
|
+
|
64
|
+
specify "cannot invoke private methods" do
|
65
|
+
lambda { CFoo.must.duck("#pfoo") }.should raise_error(Must::Invalid)
|
66
|
+
lambda { MFoo.must.duck("#pfoo") }.should raise_error(Must::Invalid)
|
67
|
+
end
|
53
68
|
end
|
54
69
|
|
55
70
|
context "(duck bang)" do
|
56
71
|
specify "[OK]" do
|
57
72
|
1.must.duck!("to_s").should == "1"
|
73
|
+
|
74
|
+
foo = CFoo.new
|
75
|
+
foo.must.duck!("foo").should == 1
|
76
|
+
foo.must.duck!("pfoo").should == 2
|
58
77
|
end
|
59
78
|
|
60
79
|
specify "[NG]" do
|
metadata
CHANGED
@@ -1,46 +1,39 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: must
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 0.3.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- maiha
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :development
|
33
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
34
30
|
description: add Object#must method to constrain its origin and conversions
|
35
|
-
email:
|
31
|
+
email:
|
36
32
|
- maiha@wota.jp
|
37
33
|
executables: []
|
38
|
-
|
39
34
|
extensions: []
|
40
|
-
|
41
35
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
files:
|
36
|
+
files:
|
44
37
|
- .gitignore
|
45
38
|
- Gemfile
|
46
39
|
- README
|
@@ -64,37 +57,28 @@ files:
|
|
64
57
|
- spec/struct_info_spec.rb
|
65
58
|
- spec/struct_spec.rb
|
66
59
|
homepage: http://github.com/maiha/must
|
67
|
-
licenses:
|
60
|
+
licenses:
|
68
61
|
- MIT
|
69
62
|
post_install_message:
|
70
63
|
rdoc_options: []
|
71
|
-
|
72
|
-
require_paths:
|
64
|
+
require_paths:
|
73
65
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
67
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
|
81
|
-
- 0
|
82
|
-
version: "0"
|
83
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
73
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
version: "0"
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
92
78
|
requirements: []
|
93
|
-
|
94
79
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.23
|
96
81
|
signing_key:
|
97
82
|
specification_version: 3
|
98
83
|
summary: a runtime specification tool
|
99
84
|
test_files: []
|
100
|
-
|