rspec_sequel_matchers 0.3.0 → 0.4.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 +4 -4
- data/LICENSE +1 -1
- data/{README.rdoc → README.md} +35 -17
- data/lib/rspec_sequel/base.rb +11 -2
- data/lib/rspec_sequel/matchers/have_one_to_one.rb +19 -0
- data/lib/rspec_sequel/validation.rb +3 -3
- data/spec/have_column_matcher_spec.rb +23 -23
- data/spec/have_many_to_many_matcher_spec.rb +14 -14
- data/spec/have_many_to_one_matcher_spec.rb +12 -12
- data/spec/have_one_to_many_matcher_spec.rb +12 -12
- data/spec/have_one_to_one_matcher_spec.rb +48 -0
- data/spec/migrations/001_create_items.rb +1 -1
- data/spec/migrations/004_create_profile.rb +18 -0
- data/spec/spec_helper.rb +10 -3
- data/spec/validate_exact_length_matcher_spec.rb +23 -23
- data/spec/validate_format_matcher_spec.rb +23 -23
- data/spec/validate_includes_matcher_spec.rb +23 -23
- data/spec/validate_integer_matcher_spec.rb +18 -18
- data/spec/validate_length_range_matcher_spec.rb +23 -23
- data/spec/validate_max_length_matcher_spec.rb +23 -23
- data/spec/validate_min_length_matcher_spec.rb +23 -23
- data/spec/validate_not_string_matcher_spec.rb +18 -18
- data/spec/validate_numeric_matcher_spec.rb +18 -18
- data/spec/validate_presence_matcher_spec.rb +18 -18
- data/spec/validate_unique_matcher_spec.rb +20 -20
- metadata +12 -9
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe "have_one_to_one_matcher" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
define_model :item do
|
7
|
+
one_to_one :profile
|
8
|
+
end
|
9
|
+
define_model :profile
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { Item }
|
13
|
+
|
14
|
+
describe "messages" do
|
15
|
+
describe "without option" do
|
16
|
+
it "should contain a description" do
|
17
|
+
@matcher = have_one_to_one :profile
|
18
|
+
expect( @matcher.description ).to eq "have a one_to_one association :profile"
|
19
|
+
end
|
20
|
+
it "should set failure messages" do
|
21
|
+
@matcher = have_one_to_one :profile
|
22
|
+
@matcher.matches? subject
|
23
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
24
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe "with options" do
|
28
|
+
it "should contain a description" do
|
29
|
+
@matcher = have_one_to_one :profile, :class_name => "Profile"
|
30
|
+
expect( @matcher.description ).to eq 'have a one_to_one association :profile with option(s) :class_name => "Profile"'
|
31
|
+
end
|
32
|
+
it "should set failure messages" do
|
33
|
+
@matcher = have_one_to_one :profile, :class_name => "Profile"
|
34
|
+
@matcher.matches? subject
|
35
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
36
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
37
|
+
end
|
38
|
+
it "should explicit used options if different than expected" do
|
39
|
+
@matcher = have_one_to_one :profile, :class_name => "Price"
|
40
|
+
@matcher.matches? subject
|
41
|
+
explanation = ' expected :class_name == "Price" but found "Profile" instead'
|
42
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
43
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateProfile < Sequel::Migration
|
2
|
+
def up
|
3
|
+
create_table :profile do
|
4
|
+
primary_key :id
|
5
|
+
foreign_key :item_id, :items, :type => Fixnum
|
6
|
+
DateTime :created_at
|
7
|
+
index :item_id
|
8
|
+
end
|
9
|
+
|
10
|
+
alter_table :items do
|
11
|
+
add_foreign_key :profile_id, :profile, :type => Fixnum
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
drop_table :profile
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,11 +5,19 @@ require "sequel/extensions/inflector"
|
|
5
5
|
require "sequel/extensions/migration"
|
6
6
|
require "rspec_sequel_matchers"
|
7
7
|
|
8
|
+
def jruby?
|
9
|
+
(defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') || defined?(JRUBY_VERSION)
|
10
|
+
end
|
11
|
+
|
8
12
|
# connect to an in-memory database
|
9
13
|
begin
|
10
|
-
|
14
|
+
if jruby?
|
15
|
+
Sequel.connect "jdbc:sqlite::memory:"
|
16
|
+
else
|
17
|
+
Sequel.sqlite
|
18
|
+
end
|
11
19
|
rescue Sequel::AdapterNotFound
|
12
|
-
puts "sqlite not available.
|
20
|
+
puts "sqlite not available."
|
13
21
|
exit 1 # failure
|
14
22
|
end
|
15
23
|
|
@@ -33,7 +41,6 @@ end
|
|
33
41
|
|
34
42
|
RSpec.configure do |c|
|
35
43
|
c.mock_framework = :rspec
|
36
|
-
c.color_enabled = true
|
37
44
|
c.include(RspecHelpers)
|
38
45
|
c.include(RspecSequel::Matchers)
|
39
46
|
# undefine models defined via define_model (if any)
|
@@ -15,24 +15,24 @@ describe "validate_exact_length_matcher" do
|
|
15
15
|
|
16
16
|
describe "arguments" do
|
17
17
|
it "should require attribute" do
|
18
|
-
|
18
|
+
expect do
|
19
19
|
@matcher = validate_exact_length
|
20
|
-
|
20
|
+
end.to raise_error
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
|
-
|
23
|
+
expect do
|
24
24
|
@matcher = validate_exact_length :name
|
25
|
-
|
25
|
+
end.to raise_error
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
|
-
|
28
|
+
expect do
|
29
29
|
@matcher = validate_exact_length :id, :name
|
30
|
-
|
30
|
+
end.to raise_error
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
|
-
|
33
|
+
expect do
|
34
34
|
@matcher = validate_exact_length 4, :name
|
35
|
-
|
35
|
+
end.not_to raise_error
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -40,49 +40,49 @@ describe "validate_exact_length_matcher" do
|
|
40
40
|
describe "without option" do
|
41
41
|
it "should contain a description" do
|
42
42
|
@matcher = validate_exact_length 4, :name
|
43
|
-
@matcher.description.
|
43
|
+
expect( @matcher.description ).to eq "validate length of :name is exactly 4"
|
44
44
|
end
|
45
45
|
it "should set failure messages" do
|
46
46
|
@matcher = validate_exact_length 4, :name
|
47
47
|
@matcher.matches? subject
|
48
|
-
@matcher.failure_message.
|
49
|
-
@matcher.
|
48
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
49
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
50
50
|
end
|
51
51
|
end
|
52
52
|
describe "with options" do
|
53
53
|
it "should contain a description" do
|
54
54
|
@matcher = validate_exact_length 4, :name, :allow_nil => true
|
55
|
-
@matcher.description.
|
55
|
+
expect( @matcher.description ).to eq "validate length of :name is exactly 4 with option(s) :allow_nil => true"
|
56
56
|
end
|
57
57
|
it "should set failure messages" do
|
58
58
|
@matcher = validate_exact_length 4, :price, :allow_nil => true
|
59
59
|
@matcher.matches? subject
|
60
|
-
@matcher.failure_message.
|
61
|
-
@matcher.
|
60
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
61
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
62
62
|
end
|
63
63
|
it "should explicit used options if different than expected" do
|
64
64
|
@matcher = validate_exact_length 4, :name, :allow_blank => true
|
65
65
|
@matcher.matches? subject
|
66
66
|
explanation = " but called with option(s) :allow_nil => true instead"
|
67
|
-
@matcher.failure_message.
|
68
|
-
@matcher.
|
67
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
68
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
69
69
|
end
|
70
70
|
it "should warn if invalid options are used" do
|
71
71
|
@matcher = validate_exact_length 4, :name, :allow_anything => true
|
72
72
|
@matcher.matches? subject
|
73
73
|
explanation = " but option :allow_anything is not valid"
|
74
|
-
@matcher.failure_message.
|
75
|
-
@matcher.
|
74
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
75
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "matchers" do
|
81
|
-
it{
|
82
|
-
it{
|
83
|
-
it{
|
84
|
-
it{
|
85
|
-
it{
|
81
|
+
it{ is_expected.to validate_exact_length(4, :name) }
|
82
|
+
it{ is_expected.to validate_exact_length(4, :name, :allow_nil => true) }
|
83
|
+
it{ is_expected.not_to validate_exact_length(4, :price) }
|
84
|
+
it{ is_expected.not_to validate_exact_length(3, :name) }
|
85
|
+
it{ is_expected.not_to validate_exact_length(4, :name, :allow_blank => true) }
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
@@ -15,24 +15,24 @@ describe "validate_format_matcher" do
|
|
15
15
|
|
16
16
|
describe "arguments" do
|
17
17
|
it "should require attribute" do
|
18
|
-
|
18
|
+
expect do
|
19
19
|
@matcher = validate_format
|
20
|
-
|
20
|
+
end.to raise_error
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
|
-
|
23
|
+
expect do
|
24
24
|
@matcher = validate_format :name
|
25
|
-
|
25
|
+
end.to raise_error
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
|
-
|
28
|
+
expect do
|
29
29
|
@matcher = validate_format :id, :name
|
30
|
-
|
30
|
+
end.to raise_error
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
|
-
|
33
|
+
expect do
|
34
34
|
@matcher = validate_format /[abc]+/, :name
|
35
|
-
|
35
|
+
end.not_to raise_error
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -40,49 +40,49 @@ describe "validate_format_matcher" do
|
|
40
40
|
describe "without option" do
|
41
41
|
it "should contain a description" do
|
42
42
|
@matcher = validate_format /[abc]+/, :name
|
43
|
-
@matcher.description.
|
43
|
+
expect( @matcher.description ).to eq "validate format of :name against /[abc]+/"
|
44
44
|
end
|
45
45
|
it "should set failure messages" do
|
46
46
|
@matcher = validate_format /[abc]+/, :name
|
47
47
|
@matcher.matches? subject
|
48
|
-
@matcher.failure_message.
|
49
|
-
@matcher.
|
48
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
49
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
50
50
|
end
|
51
51
|
end
|
52
52
|
describe "with options" do
|
53
53
|
it "should contain a description" do
|
54
54
|
@matcher = validate_format /[abc]+/, :name, :allow_nil => true
|
55
|
-
@matcher.description.
|
55
|
+
expect( @matcher.description ).to eq "validate format of :name against /[abc]+/ with option(s) :allow_nil => true"
|
56
56
|
end
|
57
57
|
it "should set failure messages" do
|
58
58
|
@matcher = validate_format /[abc]+/, :price, :allow_nil => true
|
59
59
|
@matcher.matches? subject
|
60
|
-
@matcher.failure_message.
|
61
|
-
@matcher.
|
60
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
61
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
62
62
|
end
|
63
63
|
it "should explicit used options if different than expected" do
|
64
64
|
@matcher = validate_format /[abc]+/, :name, :allow_blank => true
|
65
65
|
@matcher.matches? subject
|
66
66
|
explanation = " but called with option(s) :allow_nil => true instead"
|
67
|
-
@matcher.failure_message.
|
68
|
-
@matcher.
|
67
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
68
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
69
69
|
end
|
70
70
|
it "should warn if invalid options are used" do
|
71
71
|
@matcher = validate_format /[abc]+/, :name, :allow_anything => true
|
72
72
|
@matcher.matches? subject
|
73
73
|
explanation = " but option :allow_anything is not valid"
|
74
|
-
@matcher.failure_message.
|
75
|
-
@matcher.
|
74
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
75
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "matchers" do
|
81
|
-
it{
|
82
|
-
it{
|
83
|
-
it{
|
84
|
-
it{
|
85
|
-
it{
|
81
|
+
it{ is_expected.to validate_format(/[abc]+/, :name) }
|
82
|
+
it{ is_expected.to validate_format(/[abc]+/, :name, :allow_nil => true) }
|
83
|
+
it{ is_expected.not_to validate_format(/[abc]+/, :price) }
|
84
|
+
it{ is_expected.not_to validate_format(/[abc]/, :name) }
|
85
|
+
it{ is_expected.not_to validate_format(/[abc]+/, :name, :allow_blank => true) }
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
@@ -15,24 +15,24 @@ describe "validate_includes_matcher" do
|
|
15
15
|
|
16
16
|
describe "arguments" do
|
17
17
|
it "should require attribute" do
|
18
|
-
|
18
|
+
expect do
|
19
19
|
@matcher = validate_includes
|
20
|
-
|
20
|
+
end.to raise_error
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
|
-
|
23
|
+
expect do
|
24
24
|
@matcher = validate_includes :name
|
25
|
-
|
25
|
+
end.to raise_error
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
|
-
|
28
|
+
expect do
|
29
29
|
@matcher = validate_includes :id, :name
|
30
|
-
|
30
|
+
end.to raise_error
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
|
-
|
33
|
+
expect do
|
34
34
|
@matcher = validate_includes ["Joseph", "Jonathan"], :name
|
35
|
-
|
35
|
+
end.not_to raise_error
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -40,49 +40,49 @@ describe "validate_includes_matcher" do
|
|
40
40
|
describe "without option" do
|
41
41
|
it "should contain a description" do
|
42
42
|
@matcher = validate_includes ["Joseph", "Jonathan"], :name
|
43
|
-
@matcher.description.
|
43
|
+
expect( @matcher.description ).to eq 'validate that :name is included in ["Joseph", "Jonathan"]'
|
44
44
|
end
|
45
45
|
it "should set failure messages" do
|
46
46
|
@matcher = validate_includes ["Joseph", "Jonathan"], :name
|
47
47
|
@matcher.matches? subject
|
48
|
-
@matcher.failure_message.
|
49
|
-
@matcher.
|
48
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
49
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
50
50
|
end
|
51
51
|
end
|
52
52
|
describe "with options" do
|
53
53
|
it "should contain a description" do
|
54
54
|
@matcher = validate_includes ["Joseph", "Jonathan"], :name, :allow_nil => true
|
55
|
-
@matcher.description.
|
55
|
+
expect( @matcher.description ).to eq 'validate that :name is included in ["Joseph", "Jonathan"] with option(s) :allow_nil => true'
|
56
56
|
end
|
57
57
|
it "should set failure messages" do
|
58
58
|
@matcher = validate_includes ["Joseph", "Jonathan"], :price, :allow_nil => true
|
59
59
|
@matcher.matches? subject
|
60
|
-
@matcher.failure_message.
|
61
|
-
@matcher.
|
60
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
61
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
62
62
|
end
|
63
63
|
it "should explicit used options if different than expected" do
|
64
64
|
@matcher = validate_includes ["Joseph", "Jonathan"], :name, :allow_blank => true
|
65
65
|
@matcher.matches? subject
|
66
66
|
explanation = " but called with option(s) :allow_nil => true instead"
|
67
|
-
@matcher.failure_message.
|
68
|
-
@matcher.
|
67
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
68
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
69
69
|
end
|
70
70
|
it "should warn if invalid options are used" do
|
71
71
|
@matcher = validate_includes ["Joseph", "Jonathan"], :name, :allow_anything => true
|
72
72
|
@matcher.matches? subject
|
73
73
|
explanation = " but option :allow_anything is not valid"
|
74
|
-
@matcher.failure_message.
|
75
|
-
@matcher.
|
74
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
75
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "matchers" do
|
81
|
-
it{
|
82
|
-
it{
|
83
|
-
it{
|
84
|
-
it{
|
85
|
-
it{
|
81
|
+
it{ is_expected.to validate_includes(["Joseph", "Jonathan"], :name) }
|
82
|
+
it{ is_expected.to validate_includes(["Joseph", "Jonathan"], :name, :allow_nil => true) }
|
83
|
+
it{ is_expected.not_to validate_includes(["Joseph", "Jonathan"], :price) }
|
84
|
+
it{ is_expected.not_to validate_includes(["Joseph", "Jonathan", "Alice"], :name) }
|
85
|
+
it{ is_expected.not_to validate_includes(["Joseph", "Jonathan"], :name, :allow_blank => true) }
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
@@ -15,14 +15,14 @@ describe "validate_integer_matcher" do
|
|
15
15
|
|
16
16
|
describe "arguments" do
|
17
17
|
it "should require attribute" do
|
18
|
-
|
18
|
+
expect do
|
19
19
|
@matcher = validate_integer
|
20
|
-
|
20
|
+
end.to raise_error
|
21
21
|
end
|
22
22
|
it "should refuse additionnal parameters" do
|
23
|
-
|
23
|
+
expect do
|
24
24
|
@matcher = validate_integer :name, :id
|
25
|
-
|
25
|
+
end.to raise_error
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -30,48 +30,48 @@ describe "validate_integer_matcher" do
|
|
30
30
|
describe "without option" do
|
31
31
|
it "should contain a description" do
|
32
32
|
@matcher = validate_integer :name
|
33
|
-
@matcher.description.
|
33
|
+
expect( @matcher.description ).to eq "validate that :name is a valid integer"
|
34
34
|
end
|
35
35
|
it "should set failure messages" do
|
36
36
|
@matcher = validate_integer :name
|
37
37
|
@matcher.matches? subject
|
38
|
-
@matcher.failure_message.
|
39
|
-
@matcher.
|
38
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
39
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
40
40
|
end
|
41
41
|
end
|
42
42
|
describe "with options" do
|
43
43
|
it "should contain a description" do
|
44
44
|
@matcher = validate_integer :name, :allow_nil => true
|
45
|
-
@matcher.description.
|
45
|
+
expect( @matcher.description ).to eq "validate that :name is a valid integer with option(s) :allow_nil => true"
|
46
46
|
end
|
47
47
|
it "should set failure messages" do
|
48
48
|
@matcher = validate_integer :price, :allow_nil => true
|
49
49
|
@matcher.matches? subject
|
50
|
-
@matcher.failure_message.
|
51
|
-
@matcher.
|
50
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
51
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
52
52
|
end
|
53
53
|
it "should explicit used options if different than expected" do
|
54
54
|
@matcher = validate_integer :name, :allow_blank => true
|
55
55
|
@matcher.matches? subject
|
56
56
|
explanation = " but called with option(s) :allow_nil => true instead"
|
57
|
-
@matcher.failure_message.
|
58
|
-
@matcher.
|
57
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
58
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
59
59
|
end
|
60
60
|
it "should warn if invalid options are used" do
|
61
61
|
@matcher = validate_integer :name, :allow_anything => true
|
62
62
|
@matcher.matches? subject
|
63
63
|
explanation = " but option :allow_anything is not valid"
|
64
|
-
@matcher.failure_message.
|
65
|
-
@matcher.
|
64
|
+
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
65
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "matchers" do
|
71
|
-
it{
|
72
|
-
it{
|
73
|
-
it{
|
74
|
-
it{
|
71
|
+
it{ is_expected.to validate_integer(:name) }
|
72
|
+
it{ is_expected.to validate_integer(:name, :allow_nil => true) }
|
73
|
+
it{ is_expected.not_to validate_integer(:price) }
|
74
|
+
it{ is_expected.not_to validate_integer(:name, :allow_blank => true) }
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|