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.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sequel_spec/association/association_matcher.rb +8 -2
  3. data/lib/sequel_spec/base.rb +1 -1
  4. data/lib/sequel_spec/validation/validate_length_matcher.rb +6 -6
  5. data/lib/sequel_spec/version.rb +1 -1
  6. data/sequel_spec.gemspec +2 -2
  7. data/spec/sequel_spec/association/have_many_through_many_matcher_spec.rb +8 -8
  8. data/spec/sequel_spec/association/have_many_to_many_matcher_spec.rb +8 -8
  9. data/spec/sequel_spec/association/have_many_to_one_matcher_spec.rb +8 -8
  10. data/spec/sequel_spec/association/have_one_through_one_matcher_spec.rb +8 -8
  11. data/spec/sequel_spec/association/have_one_to_many_matcher_spec.rb +8 -8
  12. data/spec/sequel_spec/association/have_one_to_one_matcher_spec.rb +8 -8
  13. data/spec/sequel_spec/validation/validate_format_matcher_spec.rb +16 -16
  14. data/spec/sequel_spec/validation/validate_includes_matcher_spec.rb +16 -16
  15. data/spec/sequel_spec/validation/validate_integer_matcher_spec.rb +13 -13
  16. data/spec/sequel_spec/validation/validate_length_matcher_spec.rb +49 -49
  17. data/spec/sequel_spec/validation/validate_not_null_matcher_spec.rb +15 -15
  18. data/spec/sequel_spec/validation/validate_numeric_matcher_spec.rb +13 -13
  19. data/spec/sequel_spec/validation/validate_presence_matcher_spec.rb +13 -13
  20. data/spec/sequel_spec/validation/validate_schema_types_matcher_spec.rb +15 -15
  21. data/spec/sequel_spec/validation/validate_type_matcher_spec.rb +16 -16
  22. data/spec/sequel_spec/validation/validate_unique_matcher_spec.rb +15 -15
  23. data/spec/spec_helper.rb +0 -1
  24. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cc55d801d8460a333aec9a8a6e615060def64cb
4
- data.tar.gz: f777ca9fdb5a21a4da44f42aa79848db8210315a
3
+ metadata.gz: de26b2570088012fdbfa1147ccb13dfaf9adc4d3
4
+ data.tar.gz: 63fee3e646f9695259ef79b36e21eb8faa7e46df
5
5
  SHA512:
6
- metadata.gz: b2d90a2402dc7fd5e1e679e9d23f1246b52b3f96ef3a6337cbf04146071d5b1cbf872679962265732b34ea7e2b75ff0c62c7856dd1b1e882588e55ea6f768dce
7
- data.tar.gz: e48d8533c4b7238da88c7c8f98afc44337962a56ef58fa33090ff35d4ced2345b4c31805d9f7d273b0a8a7472dd9c6a424050ce420c7f99130e6940be93eecb7
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
- if @association[key] != value
21
- @suffix << "expected #{key.inspect} == #{value.inspect} but found #{@association[key].inspect} instead"
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
@@ -33,7 +33,7 @@ module SequelSpec
33
33
  [@prefix, description, @suffix].flatten.compact.join(" ")
34
34
  end
35
35
 
36
- def negative_failure_message
36
+ def failure_message_when_negated
37
37
  [@prefix, "not", description, @suffix].flatten.compact.join(" ")
38
38
  end
39
39
 
@@ -28,8 +28,8 @@ module SequelSpec
28
28
  end
29
29
 
30
30
  def is(value)
31
- unless value.is_a?(Fixnum)
32
- raise ArgumentError, "#is expects a Fixnum, #{value.class} given"
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?(Fixnum)
44
- raise ArgumentError, "#is_at_least expects a Fixnum, #{value.class} given"
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?(Fixnum)
54
- raise ArgumentError, "#is_at_most expects a Fixnum, #{value.class} given"
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
@@ -1,3 +1,3 @@
1
1
  module SequelSpec
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
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@liquidcodeworks.com"]
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.should == "have a many_through_many association :comments"
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.should == "expected Item to " + @matcher.description
29
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == 'have a many_through_many association :comments with option(s) :join_table => :comments_items'
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.should == "expected Item to " + @matcher.description
43
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == "expected Item to " + @matcher.description + explanation
51
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
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.should == "have a many_to_many association :items"
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.should == "expected Comment to " + @matcher.description
24
- @matcher.negative_failure_message.should == "expected Comment to not " + @matcher.description
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.should == 'have a many_to_many association :items with option(s) :class_name => "Item"'
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.should == "expected Comment to " + @matcher.description
38
- @matcher.negative_failure_message.should == "expected Comment to not " + @matcher.description
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.should == "expected Comment to " + @matcher.description + explanation
46
- @matcher.negative_failure_message.should == "expected Comment to not " + @matcher.description + explanation
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.should == "have a many_to_one association :item"
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.should == "expected Comment to " + @matcher.description
24
- @matcher.negative_failure_message.should == "expected Comment to not " + @matcher.description
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.should == 'have a many_to_one association :item with option(s) :class_name => "Item"'
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.should == "expected Comment to " + @matcher.description
38
- @matcher.negative_failure_message.should == "expected Comment to not " + @matcher.description
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.should == "expected Comment to " + @matcher.description + explanation
46
- @matcher.negative_failure_message.should == "expected Comment to not " + @matcher.description + explanation
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.should == "have a one_through_one association :comment"
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.should == "expected Item to " + @matcher.description
24
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == 'have a one_through_one association :comment with option(s) :class_name => "Comment"'
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.should == "expected Item to " + @matcher.description
38
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == "expected Item to " + @matcher.description + explanation
46
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
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.should == "have a one_to_many association :comments"
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.should == "expected Item to " + @matcher.description
24
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == 'have a one_to_many association :comments with option(s) :class_name => "Comment"'
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.should == "expected Item to " + @matcher.description
38
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == "expected Item to " + @matcher.description + explanation
46
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
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.should == "have a one_to_one association :comment"
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.should == "expected Item to " + @matcher.description
24
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == 'have a one_to_one association :comment with option(s) :class_name => "Comment"'
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.should == "expected Item to " + @matcher.description
38
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == "expected Item to " + @matcher.description + explanation
46
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
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.should validate_format
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.should validate_format(:name)
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.should validate_format_of(:name).with(/[abc]+/)
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.should validate_format_of(:name).with(/[xyz]+/)
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.should validate_format_of(:name).with(/[abc]+/).allowing_nil
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.should validate_format_of(:name).with(/[abc]+/).allowing_missing
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.should == "validate format of :name against /[abc]+/"
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.should == "expected Item to " + @matcher.description
63
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == "validate format of :name against /[abc]+/ with option(s) :allow_nil => true"
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.should == "expected Item to " + @matcher.description
76
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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.should == "expected Item to " + @matcher.description + explanation
84
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
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