sequel_spec 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sequel_spec/association/association_matcher.rb +8 -2
- data/lib/sequel_spec/base.rb +1 -1
- data/lib/sequel_spec/validation/validate_length_matcher.rb +6 -6
- data/lib/sequel_spec/version.rb +1 -1
- data/sequel_spec.gemspec +2 -2
- data/spec/sequel_spec/association/have_many_through_many_matcher_spec.rb +8 -8
- data/spec/sequel_spec/association/have_many_to_many_matcher_spec.rb +8 -8
- data/spec/sequel_spec/association/have_many_to_one_matcher_spec.rb +8 -8
- data/spec/sequel_spec/association/have_one_through_one_matcher_spec.rb +8 -8
- data/spec/sequel_spec/association/have_one_to_many_matcher_spec.rb +8 -8
- data/spec/sequel_spec/association/have_one_to_one_matcher_spec.rb +8 -8
- data/spec/sequel_spec/validation/validate_format_matcher_spec.rb +16 -16
- data/spec/sequel_spec/validation/validate_includes_matcher_spec.rb +16 -16
- data/spec/sequel_spec/validation/validate_integer_matcher_spec.rb +13 -13
- data/spec/sequel_spec/validation/validate_length_matcher_spec.rb +49 -49
- data/spec/sequel_spec/validation/validate_not_null_matcher_spec.rb +15 -15
- data/spec/sequel_spec/validation/validate_numeric_matcher_spec.rb +13 -13
- data/spec/sequel_spec/validation/validate_presence_matcher_spec.rb +13 -13
- data/spec/sequel_spec/validation/validate_schema_types_matcher_spec.rb +15 -15
- data/spec/sequel_spec/validation/validate_type_matcher_spec.rb +16 -16
- data/spec/sequel_spec/validation/validate_unique_matcher_spec.rb +15 -15
- data/spec/spec_helper.rb +0 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de26b2570088012fdbfa1147ccb13dfaf9adc4d3
|
4
|
+
data.tar.gz: 63fee3e646f9695259ef79b36e21eb8faa7e46df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1723528491f381b6fb2bf8845e84cc9133cd92286dc3f9168b3a0237254d7c3d182442c7f005b1282b44b47c58287126da1bf970bc842dc50538e8cd99f48dc
|
7
|
+
data.tar.gz: dce48f7a64de632b4dfa97a1fc342da2985bb6b1c4522ce5eac3c2b6f7a54b9b2ac300854555eaf2da0af5aa6a172dfdcf0287a9a627a68dba0c9066cb0cfe20
|
@@ -17,8 +17,14 @@ module SequelSpec
|
|
17
17
|
else
|
18
18
|
matching = @association[:type] == association_type
|
19
19
|
options.each do |key, value|
|
20
|
-
|
21
|
-
|
20
|
+
assoc_key = @association[key]
|
21
|
+
|
22
|
+
if assoc_key.is_a?(String) && assoc_key.start_with?('::')
|
23
|
+
assoc_key = assoc_key.demodulize
|
24
|
+
end
|
25
|
+
|
26
|
+
if assoc_key != value
|
27
|
+
@suffix << "expected #{key.inspect} == #{value.inspect} but found #{assoc_key.inspect} instead"
|
22
28
|
matching = false
|
23
29
|
end
|
24
30
|
end
|
data/lib/sequel_spec/base.rb
CHANGED
@@ -28,8 +28,8 @@ module SequelSpec
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def is(value)
|
31
|
-
unless value.is_a?(
|
32
|
-
raise ArgumentError, "#is expects
|
31
|
+
unless value.is_a?(Integer)
|
32
|
+
raise ArgumentError, "#is expects an Integer, #{value.class} given"
|
33
33
|
end
|
34
34
|
|
35
35
|
@additionnal = value
|
@@ -40,8 +40,8 @@ module SequelSpec
|
|
40
40
|
alias :is_equal_to :is
|
41
41
|
|
42
42
|
def is_at_least(value)
|
43
|
-
unless value.is_a?(
|
44
|
-
raise ArgumentError, "#is_at_least expects
|
43
|
+
unless value.is_a?(Integer)
|
44
|
+
raise ArgumentError, "#is_at_least expects an Integer, #{value.class} given"
|
45
45
|
end
|
46
46
|
|
47
47
|
@additionnal = value
|
@@ -50,8 +50,8 @@ module SequelSpec
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def is_at_most(value)
|
53
|
-
unless value.is_a?(
|
54
|
-
raise ArgumentError, "#is_at_most expects
|
53
|
+
unless value.is_a?(Integer)
|
54
|
+
raise ArgumentError, "#is_at_most expects an Integer, #{value.class} given"
|
55
55
|
end
|
56
56
|
|
57
57
|
@additionnal = value
|
data/lib/sequel_spec/version.rb
CHANGED
data/sequel_spec.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "sequel_spec"
|
8
8
|
spec.version = SequelSpec::VERSION
|
9
9
|
spec.authors = ["Adrià Planas", "Jonathan Tron", "Joseph Halter"]
|
10
|
-
spec.email = ["adriaplanas@
|
10
|
+
spec.email = ["adriaplanas@edgecodeworks.com"]
|
11
11
|
spec.summary = %q{RSpec Matchers for Sequel}
|
12
12
|
spec.homepage = "https://github.com/planas/sequel_spec"
|
13
13
|
spec.license = "MIT"
|
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
19
|
spec.add_runtime_dependency "sequel", "~> 4.0"
|
20
|
+
spec.add_runtime_dependency "rspec", "~> 3.0"
|
20
21
|
|
21
22
|
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
-
spec.add_development_dependency "rspec", "~> 2.0"
|
23
23
|
spec.add_development_dependency "database_cleaner"
|
24
24
|
spec.add_development_dependency "sqlite3"
|
25
25
|
end
|
@@ -19,36 +19,36 @@ describe "have_many_through_many_matcher" do
|
|
19
19
|
describe "without option" do
|
20
20
|
it "should contain a description" do
|
21
21
|
@matcher = have_many_through_many :comments
|
22
|
-
@matcher.description.
|
22
|
+
expect(@matcher.description).to eq "have a many_through_many association :comments"
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should set failure messages" do
|
26
26
|
@matcher = have_many_through_many :comments
|
27
27
|
@matcher.matches? subject
|
28
|
-
@matcher.failure_message.
|
29
|
-
@matcher.
|
28
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
29
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "with options" do
|
34
34
|
it "should contain a description" do
|
35
35
|
@matcher = have_many_through_many(:comments).with_options :join_table => :comments_items
|
36
|
-
@matcher.description.
|
36
|
+
expect(@matcher.description).to eq 'have a many_through_many association :comments with option(s) :join_table => :comments_items'
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should set failure messages" do
|
40
40
|
@matcher = have_many_through_many(:comments).with_options :class_name => "Comment"
|
41
41
|
@matcher.matches? subject
|
42
|
-
@matcher.failure_message.
|
43
|
-
@matcher.
|
42
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
43
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should explicit used options if different than expected" do
|
47
47
|
@matcher = have_many_through_many(:comments).with_options :join_table => :whatever
|
48
48
|
@matcher.matches? subject
|
49
49
|
explanation = ' expected :join_table == :whatever but found :comments_items instead'
|
50
|
-
@matcher.failure_message.
|
51
|
-
@matcher.
|
50
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
|
51
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -14,36 +14,36 @@ describe "have_many_to_many_matcher" do
|
|
14
14
|
describe "without option" do
|
15
15
|
it "should contain a description" do
|
16
16
|
@matcher = have_many_to_many :items
|
17
|
-
@matcher.description.
|
17
|
+
expect(@matcher.description).to eq "have a many_to_many association :items"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set failure messages" do
|
21
21
|
@matcher = have_many_to_many :items
|
22
22
|
@matcher.matches? subject
|
23
|
-
@matcher.failure_message.
|
24
|
-
@matcher.
|
23
|
+
expect(@matcher.failure_message).to eq "expected Comment to " + @matcher.description
|
24
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Comment to not " + @matcher.description
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "with options" do
|
29
29
|
it "should contain a description" do
|
30
30
|
@matcher = have_many_to_many(:items).with_options :class_name => "Item"
|
31
|
-
@matcher.description.
|
31
|
+
expect(@matcher.description).to eq 'have a many_to_many association :items with option(s) :class_name => "Item"'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should set failure messages" do
|
35
35
|
@matcher = have_many_to_many(:items).with_options :class_name => "Item"
|
36
36
|
@matcher.matches? subject
|
37
|
-
@matcher.failure_message.
|
38
|
-
@matcher.
|
37
|
+
expect(@matcher.failure_message).to eq "expected Comment to " + @matcher.description
|
38
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Comment to not " + @matcher.description
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should explicit used options if different than expected" do
|
42
42
|
@matcher = have_many_to_many(:items).with_options :class_name => "Price"
|
43
43
|
@matcher.matches? subject
|
44
44
|
explanation = ' expected :class_name == "Price" but found "Item" instead'
|
45
|
-
@matcher.failure_message.
|
46
|
-
@matcher.
|
45
|
+
expect(@matcher.failure_message).to eq "expected Comment to " + @matcher.description + explanation
|
46
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Comment to not " + @matcher.description + explanation
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -14,36 +14,36 @@ describe "have_many_to_one_matcher" do
|
|
14
14
|
describe "without option" do
|
15
15
|
it "should contain a description" do
|
16
16
|
@matcher = have_many_to_one :item
|
17
|
-
@matcher.description.
|
17
|
+
expect(@matcher.description).to eq "have a many_to_one association :item"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set failure messages" do
|
21
21
|
@matcher = have_many_to_one :item
|
22
22
|
@matcher.matches? subject
|
23
|
-
@matcher.failure_message.
|
24
|
-
@matcher.
|
23
|
+
expect(@matcher.failure_message).to eq "expected Comment to " + @matcher.description
|
24
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Comment to not " + @matcher.description
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "with options" do
|
29
29
|
it "should contain a description" do
|
30
30
|
@matcher = have_many_to_one(:item).with_options :class_name => "Item"
|
31
|
-
@matcher.description.
|
31
|
+
expect(@matcher.description).to eq 'have a many_to_one association :item with option(s) :class_name => "Item"'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should set failure messages" do
|
35
35
|
@matcher = have_many_to_one(:item).with_options :class_name => "Item"
|
36
36
|
@matcher.matches? subject
|
37
|
-
@matcher.failure_message.
|
38
|
-
@matcher.
|
37
|
+
expect(@matcher.failure_message).to eq "expected Comment to " + @matcher.description
|
38
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Comment to not " + @matcher.description
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should explicit used options if different than expected" do
|
42
42
|
@matcher = have_many_to_one(:item).with_options :class_name => "Price"
|
43
43
|
@matcher.matches? subject
|
44
44
|
explanation = ' expected :class_name == "Price" but found "Item" instead'
|
45
|
-
@matcher.failure_message.
|
46
|
-
@matcher.
|
45
|
+
expect(@matcher.failure_message).to eq "expected Comment to " + @matcher.description + explanation
|
46
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Comment to not " + @matcher.description + explanation
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -14,36 +14,36 @@ describe "have_one_through_one_matcher" do
|
|
14
14
|
describe "without option" do
|
15
15
|
it "should contain a description" do
|
16
16
|
@matcher = have_one_through_one :comment
|
17
|
-
@matcher.description.
|
17
|
+
expect(@matcher.description).to eq "have a one_through_one association :comment"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set failure messages" do
|
21
21
|
@matcher = have_one_through_one :comment
|
22
22
|
@matcher.matches? subject
|
23
|
-
@matcher.failure_message.
|
24
|
-
@matcher.
|
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
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "with options" do
|
29
29
|
it "should contain a description" do
|
30
30
|
@matcher = have_one_through_one(:comment).with_options :class_name => "Comment"
|
31
|
-
@matcher.description.
|
31
|
+
expect(@matcher.description).to eq 'have a one_through_one association :comment with option(s) :class_name => "Comment"'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should set failure messages" do
|
35
35
|
@matcher = have_one_through_one(:comment).with_options :class_name => "Comment"
|
36
36
|
@matcher.matches? subject
|
37
|
-
@matcher.failure_message.
|
38
|
-
@matcher.
|
37
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
38
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should explicit used options if different than expected" do
|
42
42
|
@matcher = have_one_through_one(:comment).with_options :class_name => "Price"
|
43
43
|
@matcher.matches? subject
|
44
44
|
explanation = ' expected :class_name == "Price" but found "Comment" instead'
|
45
|
-
@matcher.failure_message.
|
46
|
-
@matcher.
|
45
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
|
46
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -14,36 +14,36 @@ describe "have_one_to_many_matcher" do
|
|
14
14
|
describe "without option" do
|
15
15
|
it "should contain a description" do
|
16
16
|
@matcher = have_one_to_many :comments
|
17
|
-
@matcher.description.
|
17
|
+
expect(@matcher.description).to eq "have a one_to_many association :comments"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set failure messages" do
|
21
21
|
@matcher = have_one_to_many :comments
|
22
22
|
@matcher.matches? subject
|
23
|
-
@matcher.failure_message.
|
24
|
-
@matcher.
|
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
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "with options" do
|
29
29
|
it "should contain a description" do
|
30
30
|
@matcher = have_one_to_many(:comments).with_options :class_name => "Comment"
|
31
|
-
@matcher.description.
|
31
|
+
expect(@matcher.description).to eq 'have a one_to_many association :comments with option(s) :class_name => "Comment"'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should set failure messages" do
|
35
35
|
@matcher = have_one_to_many(:comments).with_options :class_name => "Comment"
|
36
36
|
@matcher.matches? subject
|
37
|
-
@matcher.failure_message.
|
38
|
-
@matcher.
|
37
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
38
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should explicit used options if different than expected" do
|
42
42
|
@matcher = have_one_to_many(:comments).with_options :class_name => "Price"
|
43
43
|
@matcher.matches? subject
|
44
44
|
explanation = ' expected :class_name == "Price" but found "Comment" instead'
|
45
|
-
@matcher.failure_message.
|
46
|
-
@matcher.
|
45
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
|
46
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -14,36 +14,36 @@ describe "have_one_to_one_matcher" do
|
|
14
14
|
describe "without option" do
|
15
15
|
it "should contain a description" do
|
16
16
|
@matcher = have_one_to_one :comment
|
17
|
-
@matcher.description.
|
17
|
+
expect(@matcher.description).to eq "have a one_to_one association :comment"
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set failure messages" do
|
21
21
|
@matcher = have_one_to_one :comment
|
22
22
|
@matcher.matches? subject
|
23
|
-
@matcher.failure_message.
|
24
|
-
@matcher.
|
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
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "with options" do
|
29
29
|
it "should contain a description" do
|
30
30
|
@matcher = have_one_to_one(:comment).with_options :class_name => "Comment"
|
31
|
-
@matcher.description.
|
31
|
+
expect(@matcher.description).to eq 'have a one_to_one association :comment with option(s) :class_name => "Comment"'
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should set failure messages" do
|
35
35
|
@matcher = have_one_to_one(:comment).with_options :class_name => "Comment"
|
36
36
|
@matcher.matches? subject
|
37
|
-
@matcher.failure_message.
|
38
|
-
@matcher.
|
37
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
38
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should explicit used options if different than expected" do
|
42
42
|
@matcher = have_one_to_one(:comment).with_options :class_name => "Price"
|
43
43
|
@matcher.matches? subject
|
44
44
|
explanation = ' expected :class_name == "Price" but found "Comment" instead'
|
45
|
-
@matcher.failure_message.
|
46
|
-
@matcher.
|
45
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
|
46
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -15,73 +15,73 @@ describe "validate_format_matcher" do
|
|
15
15
|
|
16
16
|
it "should require an attribute" do
|
17
17
|
expect {
|
18
|
-
subject.
|
18
|
+
expect(subject).to validate_format
|
19
19
|
}.to raise_error(ArgumentError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect {
|
24
|
-
subject.
|
24
|
+
expect(subject).to validate_format(:name)
|
25
25
|
}.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should accept with valid parameters" do
|
29
29
|
expect {
|
30
|
-
subject.
|
30
|
+
expect(subject).to validate_format_of(:name).with(/[abc]+/)
|
31
31
|
}.not_to raise_error
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should reject with invalid parameters" do
|
35
35
|
expect {
|
36
|
-
subject.
|
37
|
-
}.to raise_error
|
36
|
+
expect(subject).to validate_format_of(:name).with(/[xyz]+/)
|
37
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should accept with valid parameters and options" do
|
41
41
|
expect {
|
42
|
-
subject.
|
42
|
+
expect(subject).to validate_format_of(:name).with(/[abc]+/).allowing_nil
|
43
43
|
}.not_to raise_error
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should reject with valid parameters but invalid options" do
|
47
47
|
expect {
|
48
|
-
subject.
|
49
|
-
}.to raise_error
|
48
|
+
expect(subject).to validate_format_of(:name).with(/[abc]+/).allowing_missing
|
49
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError)
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "messages" do
|
53
53
|
describe "without option" do
|
54
54
|
it "should contain a description" do
|
55
55
|
@matcher = validate_format_of(:name).with(/[abc]+/)
|
56
|
-
@matcher.description.
|
56
|
+
expect(@matcher.description).to eq "validate format of :name against /[abc]+/"
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should set failure messages" do
|
60
60
|
@matcher = validate_format_of(:name).with(/[abc]+/)
|
61
61
|
@matcher.matches? subject
|
62
|
-
@matcher.failure_message.
|
63
|
-
@matcher.
|
62
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
63
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
64
64
|
end
|
65
65
|
end
|
66
66
|
describe "with options" do
|
67
67
|
it "should contain a description" do
|
68
68
|
@matcher = validate_format_of(:name).with(/[abc]+/).allowing_nil
|
69
|
-
@matcher.description.
|
69
|
+
expect(@matcher.description).to eq "validate format of :name against /[abc]+/ with option(s) :allow_nil => true"
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should set failure messages" do
|
73
73
|
@matcher = validate_format_of(:price).with(/[abc]+/).allowing_nil
|
74
74
|
@matcher.matches? subject
|
75
|
-
@matcher.failure_message.
|
76
|
-
@matcher.
|
75
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
|
76
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should explicit used options if different than expected" do
|
80
80
|
@matcher = validate_format_of(:name).with(/[abc]+/).allowing_blank
|
81
81
|
@matcher.matches? subject
|
82
82
|
explanation = " but called with option(s) :allow_nil => true instead"
|
83
|
-
@matcher.failure_message.
|
84
|
-
@matcher.
|
83
|
+
expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
|
84
|
+
expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|