rspec_sequel_matchers 0.4.0 → 0.5.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 +5 -5
- data/README.md +1 -0
- data/lib/rspec_sequel/base.rb +1 -1
- data/lib/rspec_sequel/matchers/have_many_through_many.rb +22 -0
- data/lib/rspec_sequel/matchers/validate_exact_length.rb +2 -2
- data/lib/rspec_sequel/matchers/validate_max_length.rb +2 -2
- data/lib/rspec_sequel/matchers/validate_min_length.rb +2 -2
- data/spec/have_many_through_many_matcher_spec.rb +56 -0
- data/spec/have_many_to_many_matcher_spec.rb +6 -6
- data/spec/have_many_to_one_matcher_spec.rb +8 -8
- data/spec/have_one_to_many_matcher_spec.rb +8 -8
- data/spec/have_one_to_one_matcher_spec.rb +4 -4
- data/spec/migrations/002_create_comments.rb +3 -3
- data/spec/migrations/003_create_comments_items.rb +4 -4
- data/spec/migrations/004_create_profile.rb +4 -4
- data/spec/validate_exact_length_matcher_spec.rb +3 -3
- data/spec/validate_format_matcher_spec.rb +3 -3
- data/spec/validate_includes_matcher_spec.rb +3 -3
- data/spec/validate_integer_matcher_spec.rb +2 -2
- data/spec/validate_length_range_matcher_spec.rb +3 -3
- data/spec/validate_max_length_matcher_spec.rb +3 -3
- data/spec/validate_min_length_matcher_spec.rb +3 -3
- data/spec/validate_not_string_matcher_spec.rb +2 -2
- data/spec/validate_numeric_matcher_spec.rb +2 -2
- data/spec/validate_presence_matcher_spec.rb +2 -2
- data/spec/validate_unique_matcher_spec.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a4aa69d57e65d3b26acd1a9df08e4786e189c4c56aff9af1379efaaecbfc06f6
|
4
|
+
data.tar.gz: 6d7d2fa972e6efa91d8f6dc30e2ab8c21af1064233b7ccbe22fba8a8cc45afe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21223fd91cbe41a92c9aa7399491a6d57f7cab46c3f3188ad1ab34f4c36c416c2ee379bd20c502162c39b5ba82fb21e4dee95a190416ab07165f324e8e469f08
|
7
|
+
data.tar.gz: 71442b7fcbff58b0df430f9aea267816ef9af825eab64e5c93796e884a7818e83353402925348f61cdb60f6855686776fecd0bdc1624a84e43bbe19d7552e5e2
|
data/README.md
CHANGED
data/lib/rspec_sequel/base.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module RspecSequel
|
2
|
+
module Matchers
|
3
|
+
|
4
|
+
class HaveManyThroughManyMatcher < RspecSequel::Association
|
5
|
+
def association_type
|
6
|
+
:many_through_many
|
7
|
+
end
|
8
|
+
|
9
|
+
def valid?(db, i, c, attribute, options)
|
10
|
+
matching = super
|
11
|
+
|
12
|
+
# check that association model exists, etc.
|
13
|
+
matching
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def have_many_through_many(*args)
|
18
|
+
HaveManyThroughManyMatcher.new(*args)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe "have_many_through_many_matcher" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
define_model :item
|
7
|
+
define_model :comment do
|
8
|
+
plugin :many_through_many
|
9
|
+
many_through_many :items, [[:items_comments, :item_id, :comment_id]]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
subject{ Comment }
|
14
|
+
|
15
|
+
describe "messages" do
|
16
|
+
describe "without option" do
|
17
|
+
it "should contain a description" do
|
18
|
+
@matcher = have_many_through_many :items
|
19
|
+
expect( @matcher.description ).to eq "have a many_through_many association :items"
|
20
|
+
end
|
21
|
+
it "should set failure messages" do
|
22
|
+
@matcher = have_many_through_many :items
|
23
|
+
@matcher.matches? subject
|
24
|
+
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description
|
25
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe "with options" do
|
29
|
+
it "should contain a description" do
|
30
|
+
@matcher = have_many_through_many :items, :class_name => "::Item"
|
31
|
+
expect( @matcher.description ).to eq 'have a many_through_many association :items with option(s) :class_name => "::Item"'
|
32
|
+
end
|
33
|
+
it "should set failure messages" do
|
34
|
+
@matcher = have_many_through_many :items, :class_name => "::Item"
|
35
|
+
@matcher.matches? subject
|
36
|
+
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description
|
37
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description
|
38
|
+
end
|
39
|
+
it "should explicit used options if different than expected" do
|
40
|
+
@matcher = have_many_through_many :items, :class_name => "::Price"
|
41
|
+
@matcher.matches? subject
|
42
|
+
explanation = ' expected :class_name == "::Price" but found "::Item" instead'
|
43
|
+
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description + explanation
|
44
|
+
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description + explanation
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "matchers" do
|
50
|
+
it{ is_expected.to have_many_through_many(:items) }
|
51
|
+
it{ is_expected.not_to have_many_through_many(:prices) }
|
52
|
+
it{ is_expected.not_to have_many_through_many(:items, :class_name => "Price") }
|
53
|
+
it{ is_expected.not_to have_many_through_many(:items, :join_table => :items_comments) }
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -26,19 +26,19 @@ describe "have_many_to_many_matcher" do
|
|
26
26
|
end
|
27
27
|
describe "with options" do
|
28
28
|
it "should contain a description" do
|
29
|
-
@matcher = have_many_to_many :items, :class_name => "Item"
|
30
|
-
expect( @matcher.description ).to eq 'have a many_to_many association :items with option(s) :class_name => "Item"'
|
29
|
+
@matcher = have_many_to_many :items, :class_name => "::Item"
|
30
|
+
expect( @matcher.description ).to eq 'have a many_to_many association :items with option(s) :class_name => "::Item"'
|
31
31
|
end
|
32
32
|
it "should set failure messages" do
|
33
|
-
@matcher = have_many_to_many :items, :class_name => "Item"
|
33
|
+
@matcher = have_many_to_many :items, :class_name => "::Item"
|
34
34
|
@matcher.matches? subject
|
35
35
|
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description
|
36
36
|
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description
|
37
37
|
end
|
38
38
|
it "should explicit used options if different than expected" do
|
39
|
-
@matcher = have_many_to_many :items, :class_name => "Price"
|
39
|
+
@matcher = have_many_to_many :items, :class_name => "::Price"
|
40
40
|
@matcher.matches? subject
|
41
|
-
explanation = ' expected :class_name == "Price" but found "Item" instead'
|
41
|
+
explanation = ' expected :class_name == "::Price" but found "::Item" instead'
|
42
42
|
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description + explanation
|
43
43
|
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description + explanation
|
44
44
|
end
|
@@ -47,7 +47,7 @@ describe "have_many_to_many_matcher" do
|
|
47
47
|
|
48
48
|
describe "matchers" do
|
49
49
|
it{ is_expected.to have_many_to_many(:items) }
|
50
|
-
it{ is_expected.to have_many_to_many(:items, :class_name => "Item", :join_table => :comments_items) }
|
50
|
+
it{ is_expected.to have_many_to_many(:items, :class_name => "::Item", :join_table => :comments_items) }
|
51
51
|
it{ is_expected.not_to have_many_to_many(:prices) }
|
52
52
|
it{ is_expected.not_to have_many_to_many(:items, :class_name => "Price") }
|
53
53
|
it{ is_expected.not_to have_many_to_many(:items, :join_table => :items_comments) }
|
@@ -26,19 +26,19 @@ describe "have_many_to_one_matcher" do
|
|
26
26
|
end
|
27
27
|
describe "with options" do
|
28
28
|
it "should contain a description" do
|
29
|
-
@matcher = have_many_to_one :item, :class_name => "Item"
|
30
|
-
expect( @matcher.description ).to eq 'have a many_to_one association :item with option(s) :class_name => "Item"'
|
29
|
+
@matcher = have_many_to_one :item, :class_name => "::Item"
|
30
|
+
expect( @matcher.description ).to eq 'have a many_to_one association :item with option(s) :class_name => "::Item"'
|
31
31
|
end
|
32
32
|
it "should set failure messages" do
|
33
|
-
@matcher = have_many_to_one :item, :class_name => "Item"
|
33
|
+
@matcher = have_many_to_one :item, :class_name => "::Item"
|
34
34
|
@matcher.matches? subject
|
35
35
|
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description
|
36
36
|
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description
|
37
37
|
end
|
38
38
|
it "should explicit used options if different than expected" do
|
39
|
-
@matcher = have_many_to_one :item, :class_name => "Price"
|
39
|
+
@matcher = have_many_to_one :item, :class_name => "::Price"
|
40
40
|
@matcher.matches? subject
|
41
|
-
explanation = ' expected :class_name == "Price" but found "Item" instead'
|
41
|
+
explanation = ' expected :class_name == "::Price" but found "::Item" instead'
|
42
42
|
expect( @matcher.failure_message ).to eq "expected Comment to " + @matcher.description + explanation
|
43
43
|
expect( @matcher.failure_message_when_negated ).to eq "expected Comment to not " + @matcher.description + explanation
|
44
44
|
end
|
@@ -47,9 +47,9 @@ describe "have_many_to_one_matcher" do
|
|
47
47
|
|
48
48
|
describe "matchers" do
|
49
49
|
it{ is_expected.to have_many_to_one(:item) }
|
50
|
-
it{ is_expected.to have_many_to_one(:item, :class_name => "Item") }
|
50
|
+
it{ is_expected.to have_many_to_one(:item, :class_name => "::Item") }
|
51
51
|
it{ is_expected.not_to have_many_to_one(:price) }
|
52
|
-
it{ is_expected.not_to have_many_to_one(:item, :class_name => "Price") }
|
52
|
+
it{ is_expected.not_to have_many_to_one(:item, :class_name => "::Price") }
|
53
53
|
end
|
54
54
|
|
55
|
-
end
|
55
|
+
end
|
@@ -26,19 +26,19 @@ describe "have_one_to_many_matcher" do
|
|
26
26
|
end
|
27
27
|
describe "with options" do
|
28
28
|
it "should contain a description" do
|
29
|
-
@matcher = have_one_to_many :comments, :class_name => "Comment"
|
30
|
-
expect( @matcher.description ).to eq 'have a one_to_many association :comments with option(s) :class_name => "Comment"'
|
29
|
+
@matcher = have_one_to_many :comments, :class_name => "::Comment"
|
30
|
+
expect( @matcher.description ).to eq 'have a one_to_many association :comments with option(s) :class_name => "::Comment"'
|
31
31
|
end
|
32
32
|
it "should set failure messages" do
|
33
|
-
@matcher = have_one_to_many :comments, :class_name => "Comment"
|
33
|
+
@matcher = have_one_to_many :comments, :class_name => "::Comment"
|
34
34
|
@matcher.matches? subject
|
35
35
|
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
36
36
|
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
37
37
|
end
|
38
38
|
it "should explicit used options if different than expected" do
|
39
|
-
@matcher = have_one_to_many :comments, :class_name => "Price"
|
39
|
+
@matcher = have_one_to_many :comments, :class_name => "::Price"
|
40
40
|
@matcher.matches? subject
|
41
|
-
explanation = ' expected :class_name == "Price" but found "Comment" instead'
|
41
|
+
explanation = ' expected :class_name == "::Price" but found "::Comment" instead'
|
42
42
|
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
43
43
|
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
44
44
|
end
|
@@ -47,9 +47,9 @@ describe "have_one_to_many_matcher" do
|
|
47
47
|
|
48
48
|
describe "matchers" do
|
49
49
|
it{ is_expected.to have_one_to_many(:comments) }
|
50
|
-
it{ is_expected.to have_one_to_many(:comments, :class_name => "Comment") }
|
50
|
+
it{ is_expected.to have_one_to_many(:comments, :class_name => "::Comment") }
|
51
51
|
it{ is_expected.not_to have_one_to_many(:prices) }
|
52
|
-
it{ is_expected.not_to have_one_to_many(:comments, :class_name => "Price") }
|
52
|
+
it{ is_expected.not_to have_one_to_many(:comments, :class_name => "::Price") }
|
53
53
|
end
|
54
54
|
|
55
|
-
end
|
55
|
+
end
|
@@ -3,10 +3,10 @@ require File.dirname(__FILE__) + "/spec_helper"
|
|
3
3
|
describe "have_one_to_one_matcher" do
|
4
4
|
|
5
5
|
before do
|
6
|
+
define_model :profile
|
6
7
|
define_model :item do
|
7
8
|
one_to_one :profile
|
8
9
|
end
|
9
|
-
define_model :profile
|
10
10
|
end
|
11
11
|
|
12
12
|
subject { Item }
|
@@ -30,15 +30,15 @@ describe "have_one_to_one_matcher" do
|
|
30
30
|
expect( @matcher.description ).to eq 'have a one_to_one association :profile with option(s) :class_name => "Profile"'
|
31
31
|
end
|
32
32
|
it "should set failure messages" do
|
33
|
-
@matcher = have_one_to_one :profile, :class_name => "Profile"
|
33
|
+
@matcher = have_one_to_one :profile, :class_name => "::Profile"
|
34
34
|
@matcher.matches? subject
|
35
35
|
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description
|
36
36
|
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description
|
37
37
|
end
|
38
38
|
it "should explicit used options if different than expected" do
|
39
|
-
@matcher = have_one_to_one :profile, :class_name => "Price"
|
39
|
+
@matcher = have_one_to_one :profile, :class_name => "::Price"
|
40
40
|
@matcher.matches? subject
|
41
|
-
explanation = ' expected :class_name == "Price" but found "Profile" instead'
|
41
|
+
explanation = ' expected :class_name == "::Price" but found "::Profile" instead'
|
42
42
|
expect( @matcher.failure_message ).to eq "expected Item to " + @matcher.description + explanation
|
43
43
|
expect( @matcher.failure_message_when_negated ).to eq "expected Item to not " + @matcher.description + explanation
|
44
44
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class CreateComments < Sequel::Migration
|
2
2
|
|
3
3
|
def up
|
4
|
-
create_table :comments do
|
4
|
+
create_table :comments do
|
5
5
|
primary_key :id
|
6
|
-
foreign_key :item_id, :items, :type =>
|
6
|
+
foreign_key :item_id, :items, :type => Integer
|
7
7
|
String :content
|
8
8
|
DateTime :created_at
|
9
9
|
index :item_id
|
@@ -14,4 +14,4 @@ class CreateComments < Sequel::Migration
|
|
14
14
|
drop_table :comments
|
15
15
|
end
|
16
16
|
|
17
|
-
end
|
17
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class CreateCommentsItems < Sequel::Migration
|
2
2
|
|
3
3
|
def up
|
4
|
-
create_table :comments_items do
|
5
|
-
foreign_key :comment_id, :comments, :type =>
|
6
|
-
foreign_key :item_id, :items, :type =>
|
4
|
+
create_table :comments_items do
|
5
|
+
foreign_key :comment_id, :comments, :type => Integer
|
6
|
+
foreign_key :item_id, :items, :type => Integer
|
7
7
|
index [:comment_id, :item_id], :unique => true
|
8
8
|
end
|
9
9
|
end
|
@@ -12,4 +12,4 @@ class CreateCommentsItems < Sequel::Migration
|
|
12
12
|
drop_table :comments_items
|
13
13
|
end
|
14
14
|
|
15
|
-
end
|
15
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
class CreateProfile < Sequel::Migration
|
2
2
|
def up
|
3
|
-
create_table :
|
3
|
+
create_table :profiles do
|
4
4
|
primary_key :id
|
5
|
-
foreign_key :item_id, :items, :type =>
|
5
|
+
foreign_key :item_id, :items, :type => Integer
|
6
6
|
DateTime :created_at
|
7
7
|
index :item_id
|
8
8
|
end
|
9
9
|
|
10
10
|
alter_table :items do
|
11
|
-
add_foreign_key :profile_id, :profile, :type =>
|
11
|
+
add_foreign_key :profile_id, :profile, :type => Integer
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def down
|
16
|
-
drop_table :
|
16
|
+
drop_table :profiles
|
17
17
|
end
|
18
18
|
end
|
@@ -17,17 +17,17 @@ describe "validate_exact_length_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_exact_length
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_exact_length :name
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
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
|
-
end.to raise_error
|
30
|
+
end.to raise_error(ArgumentError)
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
33
|
expect do
|
@@ -17,17 +17,17 @@ describe "validate_format_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_format
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_format :name
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
28
|
expect do
|
29
29
|
@matcher = validate_format :id, :name
|
30
|
-
end.to raise_error
|
30
|
+
end.to raise_error(ArgumentError)
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
33
|
expect do
|
@@ -17,17 +17,17 @@ describe "validate_includes_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_includes
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_includes :name
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
28
|
expect do
|
29
29
|
@matcher = validate_includes :id, :name
|
30
|
-
end.to raise_error
|
30
|
+
end.to raise_error(ArgumentError)
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
33
|
expect do
|
@@ -17,12 +17,12 @@ describe "validate_integer_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_integer
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should refuse additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_integer :name, :id
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -17,17 +17,17 @@ describe "validate_length_range_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_length_range
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_length_range :name
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
28
|
expect do
|
29
29
|
@matcher = validate_length_range :id, :name
|
30
|
-
end.to raise_error
|
30
|
+
end.to raise_error(ArgumentError)
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
33
|
expect do
|
@@ -17,17 +17,17 @@ describe "validate_max_length_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_max_length
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_max_length :name
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
28
|
expect do
|
29
29
|
@matcher = validate_max_length :id, :name
|
30
|
-
end.to raise_error
|
30
|
+
end.to raise_error(ArgumentError)
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
33
|
expect do
|
@@ -17,17 +17,17 @@ describe "validate_min_length_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_min_length
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should require additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_min_length :name
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
it "should refuse invalid additionnal parameters" do
|
28
28
|
expect do
|
29
29
|
@matcher = validate_min_length :id, :name
|
30
|
-
end.to raise_error
|
30
|
+
end.to raise_error(ArgumentError)
|
31
31
|
end
|
32
32
|
it "should accept valid additionnal parameters" do
|
33
33
|
expect do
|
@@ -17,12 +17,12 @@ describe "validate_not_string_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_not_string
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should refuse additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_not_string :name, :id
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -17,12 +17,12 @@ describe "validate_numeric_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_numeric
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should refuse additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_numeric :name, :id
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -17,12 +17,12 @@ describe "validate_presence_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_presence
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should refuse additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_presence :name, :id
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -17,12 +17,12 @@ describe "validate_unique_matcher" do
|
|
17
17
|
it "should require attribute" do
|
18
18
|
expect do
|
19
19
|
@matcher = validate_unique
|
20
|
-
end.to raise_error
|
20
|
+
end.to raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
it "should refuse additionnal parameters" do
|
23
23
|
expect do
|
24
24
|
@matcher = validate_unique :name, :id
|
25
|
-
end.to raise_error
|
25
|
+
end.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_sequel_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Tron
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/rspec_sequel/association.rb
|
67
67
|
- lib/rspec_sequel/base.rb
|
68
68
|
- lib/rspec_sequel/matchers/have_column.rb
|
69
|
+
- lib/rspec_sequel/matchers/have_many_through_many.rb
|
69
70
|
- lib/rspec_sequel/matchers/have_many_to_many.rb
|
70
71
|
- lib/rspec_sequel/matchers/have_many_to_one.rb
|
71
72
|
- lib/rspec_sequel/matchers/have_one_to_many.rb
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- lib/rspec_sequel/validation.rb
|
85
86
|
- lib/rspec_sequel_matchers.rb
|
86
87
|
- spec/have_column_matcher_spec.rb
|
88
|
+
- spec/have_many_through_many_matcher_spec.rb
|
87
89
|
- spec/have_many_to_many_matcher_spec.rb
|
88
90
|
- spec/have_many_to_one_matcher_spec.rb
|
89
91
|
- spec/have_one_to_many_matcher_spec.rb
|
@@ -124,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
126
|
version: '0'
|
125
127
|
requirements: []
|
126
128
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.7.3
|
128
130
|
signing_key:
|
129
131
|
specification_version: 4
|
130
132
|
summary: RSpec Matchers for Sequel
|