sequel_spec 0.1.1 → 0.2.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.
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
@@ -15,61 +15,61 @@ describe "validate_numeric_matcher" do
15
15
 
16
16
  it "should require an attribute" do
17
17
  expect {
18
- subject.should validate_numeric
18
+ expect(subject).to validate_numeric
19
19
  }.to raise_error(ArgumentError)
20
20
  end
21
21
 
22
22
  it "should accept with an attribute" do
23
23
  expect {
24
- subject.should validate_numeric(:name)
24
+ expect(subject).to validate_numeric(:name)
25
25
  }.not_to raise_error
26
26
  end
27
27
 
28
28
  it "should accept with valid options" do
29
29
  expect {
30
- subject.should validate_numeric(:name).allowing_nil
30
+ expect(subject).to validate_numeric(:name).allowing_nil
31
31
  }.not_to raise_error
32
32
  end
33
33
 
34
34
  it "should reject with invalid options" do
35
35
  expect {
36
- subject.should validate_numeric(:name).allowing_blank
37
- }.to raise_error
36
+ expect(subject).to validate_numeric(:name).allowing_blank
37
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
38
38
  end
39
39
 
40
40
  describe "messages" do
41
41
  describe "without option" do
42
42
  it "should contain a description" do
43
43
  @matcher = validate_numeric :name
44
- @matcher.description.should == "validate that :name is a valid float"
44
+ expect(@matcher.description).to eq "validate that :name is a valid float"
45
45
  end
46
46
 
47
47
  it "should set failure messages" do
48
48
  @matcher = validate_numeric :name
49
49
  @matcher.matches? subject
50
- @matcher.failure_message.should == "expected Item to " + @matcher.description
51
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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
  end
54
54
  describe "with options" do
55
55
  it "should contain a description" do
56
56
  @matcher = validate_numeric(:name).allowing_nil
57
- @matcher.description.should == "validate that :name is a valid float with option(s) :allow_nil => true"
57
+ expect(@matcher.description).to eq "validate that :name is a valid float with option(s) :allow_nil => true"
58
58
  end
59
59
 
60
60
  it "should set failure messages" do
61
61
  @matcher = validate_numeric(:price).allowing_nil
62
62
  @matcher.matches? subject
63
- @matcher.failure_message.should == "expected Item to " + @matcher.description
64
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
63
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
64
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
65
65
  end
66
66
 
67
67
  it "should explicit used options if different than expected" do
68
68
  @matcher = validate_numeric(:name).allowing_blank
69
69
  @matcher.matches? subject
70
70
  explanation = " but called with option(s) :allow_nil => true instead"
71
- @matcher.failure_message.should == "expected Item to " + @matcher.description + explanation
72
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
71
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
72
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
73
73
  end
74
74
  end
75
75
  end
@@ -15,62 +15,62 @@ describe "validate_presence_matcher" do
15
15
 
16
16
  it "should require an attribute" do
17
17
  expect {
18
- subject.should validate_presence
18
+ expect(subject).to validate_presence
19
19
  }.to raise_error(ArgumentError)
20
20
  end
21
21
 
22
22
  it "should accept with an attribute" do
23
23
  expect {
24
- subject.should validate_presence(:name)
24
+ expect(subject).to validate_presence(:name)
25
25
  }.not_to raise_error
26
26
  end
27
27
 
28
28
  it "should accept with valid options" do
29
29
  expect {
30
- subject.should validate_presence(:name).allowing_nil
30
+ expect(subject).to validate_presence(:name).allowing_nil
31
31
  }.not_to raise_error
32
32
  end
33
33
 
34
34
  it "should reject with invalid options" do
35
35
  expect {
36
- subject.should validate_presence(:name).allowing_blank
37
- }.to raise_error
36
+ expect(subject).to validate_presence(:name).allowing_blank
37
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
38
38
  end
39
39
 
40
40
  describe "messages" do
41
41
  describe "without option" do
42
42
  it "should contain a description" do
43
43
  @matcher = validate_presence :name
44
- @matcher.description.should == "validate presence of :name"
44
+ expect(@matcher.description).to eq "validate presence of :name"
45
45
  end
46
46
 
47
47
  it "should set failure messages" do
48
48
  @matcher = validate_presence :name
49
49
  @matcher.matches? subject
50
- @matcher.failure_message.should == "expected Item to " + @matcher.description
51
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
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
  end
54
54
 
55
55
  describe "with options" do
56
56
  it "should contain a description" do
57
57
  @matcher = validate_presence(:name).allowing_nil
58
- @matcher.description.should == "validate presence of :name with option(s) :allow_nil => true"
58
+ expect(@matcher.description).to eq "validate presence of :name with option(s) :allow_nil => true"
59
59
  end
60
60
 
61
61
  it "should set failure messages" do
62
62
  @matcher = validate_presence(:price).allowing_nil
63
63
  @matcher.matches? subject
64
- @matcher.failure_message.should == "expected Item to " + @matcher.description
65
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
64
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
65
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
66
66
  end
67
67
 
68
68
  it "should explicit used options if different than expected" do
69
69
  @matcher = validate_presence(:name).allowing_blank
70
70
  @matcher.matches? subject
71
71
  explanation = " but called with option(s) :allow_nil => true instead"
72
- @matcher.failure_message.should == "expected Item to " + @matcher.description + explanation
73
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
72
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
73
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
74
74
  end
75
75
  end
76
76
  end
@@ -15,68 +15,68 @@ describe "validate_schema_types_matcher" do
15
15
 
16
16
  it "should require an attribute" do
17
17
  expect {
18
- subject.should validate_schema_types_of
18
+ expect(subject).to validate_schema_types_of
19
19
  }.to raise_error(ArgumentError)
20
20
  end
21
21
 
22
22
  it "should accept with valid parameters" do
23
23
  expect {
24
- subject.should validate_schema_types_of(:name)
24
+ expect(subject).to validate_schema_types_of(:name)
25
25
  }.not_to raise_error
26
26
  end
27
27
 
28
28
  it "should reject with invalid parameters" do
29
29
  expect {
30
- subject.should validate_schema_types_of(:origin)
31
- }.to raise_error
30
+ expect(subject).to validate_schema_types_of(:origin)
31
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
32
32
  end
33
33
 
34
34
  it "should accept with valid parameters and valid options" do
35
35
  expect {
36
- subject.should validate_schema_types_of(:name).with_message "Not a valid string"
36
+ expect(subject).to validate_schema_types_of(:name).with_message "Not a valid string"
37
37
  }.not_to raise_error
38
38
  end
39
39
 
40
40
  it "should reject with valid parameters but invalid options" do
41
41
  expect {
42
- subject.should validate_schema_types_of(:name).allowing_blank
43
- }.to raise_error
42
+ expect(subject).to validate_schema_types_of(:name).allowing_blank
43
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
44
44
  end
45
45
 
46
46
  describe "messages" do
47
47
  describe "without option" do
48
48
  it "should contain a description" do
49
49
  @matcher = validate_schema_types_of(:name)
50
- @matcher.description.should == 'validate schema types of :name'
50
+ expect(@matcher.description).to eq 'validate schema types of :name'
51
51
  end
52
52
 
53
53
  it "should set failure messages" do
54
54
  @matcher = validate_schema_types_of(:name)
55
55
  @matcher.matches? subject
56
- @matcher.failure_message.should == "expected Item to " + @matcher.description
57
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
56
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
57
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
58
58
  end
59
59
  end
60
60
 
61
61
  describe "with options" do
62
62
  it "should contain a description" do
63
63
  @matcher = validate_schema_types_of(:name).with_message "Not a valid string"
64
- @matcher.description.should == 'validate schema types of :name with option(s) :message => "Not a valid string"'
64
+ expect(@matcher.description).to eq 'validate schema types of :name with option(s) :message => "Not a valid string"'
65
65
  end
66
66
 
67
67
  it "should set failure messages" do
68
68
  @matcher = validate_schema_types_of(:username).with_message("Not a valid string")
69
69
  @matcher.matches? subject
70
- @matcher.failure_message.should == "expected Item to " + @matcher.description
71
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
70
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
71
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
72
72
  end
73
73
 
74
74
  it "should explicit used options if different than expected" do
75
75
  @matcher = validate_schema_types_of(:name).with_message "Not a valid hash"
76
76
  @matcher.matches? subject
77
77
  explanation = ' but called with option(s) :message => "Not a valid string" instead'
78
- @matcher.failure_message.should == "expected Item to " + @matcher.description + explanation
79
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
78
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
79
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
80
80
  end
81
81
  end
82
82
  end
@@ -15,73 +15,73 @@ describe "validate_type_matcher" do
15
15
 
16
16
  it "should require an attribute" do
17
17
  expect {
18
- subject.should validate_type_of
18
+ expect(subject).to validate_type_of
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_type_of(:name)
24
+ expect(subject).to validate_type_of(: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_type_of(:name).is [String, Integer]
30
+ expect(subject).to validate_type_of(:name).is [String, Integer]
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_type_of(:name).is [Array, Integer]
37
- }.to raise_error
36
+ expect(subject).to validate_type_of(:name).is [Array, Integer]
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_type_of(:name).is([String, Integer]).allowing_nil
42
+ expect(subject).to validate_type_of(:name).is([String, Integer]).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_type_of(:name).is([String, Integer]).allowing_blank
49
- }.to raise_error
48
+ expect(subject).to validate_type_of(:name).is([String, Integer]).allowing_blank
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_type_of(:name).is Integer
56
- @matcher.description.should == 'validate that type of :name is Integer'
56
+ expect(@matcher.description).to eq 'validate that type of :name is Integer'
57
57
  end
58
58
 
59
59
  it "should set failure messages" do
60
60
  @matcher = validate_type_of(:name).is [String, Integer]
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_type_of(:name).is([String, Integer]).allowing_nil
69
- @matcher.description.should == 'validate that type of :name is [String, Integer] with option(s) :allow_nil => true'
69
+ expect(@matcher.description).to eq 'validate that type of :name is [String, Integer] with option(s) :allow_nil => true'
70
70
  end
71
71
 
72
72
  it "should set failure messages" do
73
73
  @matcher = validate_type_of(:price).is([String, Integer]).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_type_of(:name).is([String, Integer]).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
@@ -15,68 +15,68 @@ describe "validate_unique_matcher" do
15
15
 
16
16
  it "should require an attribute" do
17
17
  expect {
18
- subject.should validate_unique
18
+ expect(subject).to validate_unique
19
19
  }.to raise_error(ArgumentError)
20
20
  end
21
21
 
22
22
  it "should accept with an attribute" do
23
23
  expect {
24
- subject.should validate_unique(:name)
24
+ expect(subject).to validate_unique(:name)
25
25
  }.not_to raise_error
26
26
  end
27
27
 
28
28
  it "should accept with valid options" do
29
29
  expect {
30
- subject.should validate_unique(:name).with_message "Hello"
30
+ expect(subject).to validate_unique(:name).with_message "Hello"
31
31
  }.not_to raise_error
32
32
  end
33
33
 
34
34
  it "should reject with options with invalid values" do
35
35
  expect {
36
- subject.should validate_unique(:name).with_message "Bye"
37
- }.to raise_error
36
+ expect(subject).to validate_unique(:name).with_message "Bye"
37
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
38
38
  end
39
39
 
40
40
  it "should reject with invalid options" do
41
41
  expect {
42
- subject.should validate_unique(:name).allowing_nil
43
- }.to raise_error
42
+ expect(subject).to validate_unique(:name).allowing_nil
43
+ }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
44
44
  end
45
45
 
46
46
  describe "messages" do
47
47
  describe "without option" do
48
48
  it "should contain a description" do
49
49
  @matcher = validate_unique :name
50
- @matcher.description.should == "validate uniqueness of :name"
50
+ expect(@matcher.description).to eq "validate uniqueness of :name"
51
51
  end
52
52
 
53
53
  it "should set failure messages" do
54
54
  @matcher = validate_unique :name
55
55
  @matcher.matches? subject
56
- @matcher.failure_message.should == "expected Item to " + @matcher.description
57
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
56
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
57
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
58
58
  end
59
59
  end
60
60
 
61
61
  describe "with options" do
62
62
  it "should contain a description" do
63
63
  @matcher = validate_unique(:name).with_message("Hello")
64
- @matcher.description.should == 'validate uniqueness of :name with option(s) :message => "Hello"'
64
+ expect(@matcher.description).to eq 'validate uniqueness of :name with option(s) :message => "Hello"'
65
65
  end
66
66
 
67
67
  it "should set failure messages" do
68
68
  @matcher = validate_unique(:price).with_message("Hello")
69
69
  @matcher.matches? subject
70
- @matcher.failure_message.should == "expected Item to " + @matcher.description
71
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description
70
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description
71
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description
72
72
  end
73
73
 
74
74
  it "should explicit used options if different than expected" do
75
75
  @matcher = validate_unique(:name).with_message("Hello world")
76
76
  @matcher.matches? subject
77
77
  explanation = ' but called with option(s) :message => "Hello" instead'
78
- @matcher.failure_message.should == "expected Item to " + @matcher.description + explanation
79
- @matcher.negative_failure_message.should == "expected Item to not " + @matcher.description + explanation
78
+ expect(@matcher.failure_message).to eq "expected Item to " + @matcher.description + explanation
79
+ expect(@matcher.failure_message_when_negated).to eq "expected Item to not " + @matcher.description + explanation
80
80
  end
81
81
  end
82
82
  end
data/spec/spec_helper.rb CHANGED
@@ -9,7 +9,6 @@ require 'support/test_helpers'
9
9
  DB = Sequel.connect('sqlite://test.db')
10
10
 
11
11
  RSpec.configure do |config|
12
- config.treat_symbols_as_metadata_keys_with_true_values = true
13
12
  config.run_all_when_everything_filtered = true
14
13
  config.order = 'random'
15
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrià Planas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-10 00:00:00.000000000 Z
13
+ date: 2017-03-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sequel
@@ -27,33 +27,33 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: '4.0'
29
29
  - !ruby/object:Gem::Dependency
30
- name: bundler
30
+ name: rspec
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '1.5'
36
- type: :development
35
+ version: '3.0'
36
+ type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.5'
42
+ version: '3.0'
43
43
  - !ruby/object:Gem::Dependency
44
- name: rspec
44
+ name: bundler
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.0'
49
+ version: '1.5'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '2.0'
56
+ version: '1.5'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: database_cleaner
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +84,7 @@ dependencies:
84
84
  version: '0'
85
85
  description:
86
86
  email:
87
- - adriaplanas@liquidcodeworks.com
87
+ - adriaplanas@edgecodeworks.com
88
88
  executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.2.2
162
+ rubygems_version: 2.6.10
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: RSpec Matchers for Sequel