warp 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +3 -0
- data/lib/warp/model_matchers/association_matcher.rb +3 -7
- data/lib/warp/version.rb +1 -1
- data/spec/warp/{model_helpers → model_matchers}/association_matcher_spec.rb +13 -20
- data/spec/warp/{model_helpers → model_matchers}/attribute_matcher_spec.rb +0 -0
- data/spec/warp/{model_helpers → model_matchers}/validation_matcher_spec.rb +0 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e70da9075f2beae56344d463b528607d1f18b1ec
|
4
|
+
data.tar.gz: 8c6ed89c28d1e174b2ac313267dc8665f176b3f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61e2ab2c14102df7ed581ab6d4a81d1889aaa852650b77b6113c7181dda8204154fd41fb0c01db05e564e8182aa19df4b4d889c28320e728d6b7be4f4de0169b
|
7
|
+
data.tar.gz: b1a7666e777fcb4ba6aeb1c25830b189870399e1ac80868a3350ca21c6fddbbca9ed40dddb523c5951574a05759684c9e85abdc6ecd932d7003a23df5a266e10
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ module Warp
|
|
4
4
|
module ModelMatchers
|
5
5
|
class AssociationMatcher < Warp::ModelMatchers::Matcher
|
6
6
|
attr_reader :expected_macro, :key
|
7
|
-
|
7
|
+
|
8
8
|
def initialize(expected_macro, key)
|
9
9
|
@expected_macro = expected_macro
|
10
10
|
@key = key
|
@@ -56,11 +56,7 @@ module Warp
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def have_and_belong_to_many(key)
|
59
|
-
|
60
|
-
raise NotImplementedError, "In Rail 4.1+ the has_and_belongs_to_many helper produces a has_many :through association."
|
61
|
-
else
|
62
|
-
AssociationMatcher.new(:has_and_belongs_to_many, key)
|
63
|
-
end
|
59
|
+
AssociationMatcher.new(:has_and_belongs_to_many, key)
|
64
60
|
end
|
65
61
|
end
|
66
|
-
end
|
62
|
+
end
|
data/lib/warp/version.rb
CHANGED
@@ -20,16 +20,12 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
behaviour do
|
23
|
-
if ActiveRecord::VERSION::STRING[0] == "4" && ActiveRecord::VERSION::STRING[3] != "0"
|
24
|
-
specify { expect{ have_and_belong_to_many(:foo) }.to raise_error(NotImplementedError) }
|
25
|
-
end
|
26
|
-
|
27
23
|
with_contexts do
|
28
24
|
let(:no_association_key) { :foobar }
|
29
25
|
|
30
26
|
describe "#have_many" do
|
31
27
|
let(:matcher) { have_many(key) }
|
32
|
-
|
28
|
+
|
33
29
|
let(:matcher_macro) { :has_many }
|
34
30
|
let(:association_key) { :bars }
|
35
31
|
let(:wrong_association_key) { :foo }
|
@@ -37,7 +33,7 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
37
33
|
|
38
34
|
describe "#have_one" do
|
39
35
|
let(:matcher) { have_one(key) }
|
40
|
-
|
36
|
+
|
41
37
|
let(:matcher_macro) { :has_one }
|
42
38
|
let(:association_key) { :baz }
|
43
39
|
let(:wrong_association_key) { :foo }
|
@@ -45,21 +41,18 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
45
41
|
|
46
42
|
describe "#belong_to" do
|
47
43
|
let(:matcher) { belong_to(key) }
|
48
|
-
|
44
|
+
|
49
45
|
let(:matcher_macro) { :belongs_to }
|
50
46
|
let(:association_key) { :foo }
|
51
47
|
let(:wrong_association_key) { :bars }
|
52
48
|
end
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
let(:association_key) { :qux }
|
61
|
-
let(:wrong_association_key) { :foo }
|
62
|
-
end
|
50
|
+
describe "#have_and_belong_to_many" do
|
51
|
+
let(:matcher) { have_and_belong_to_many(key) }
|
52
|
+
|
53
|
+
let(:matcher_macro) { :has_and_belongs_to_many }
|
54
|
+
let(:association_key) { :qux }
|
55
|
+
let(:wrong_association_key) { :foo }
|
63
56
|
end
|
64
57
|
|
65
58
|
behaviour do
|
@@ -70,7 +63,7 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
70
63
|
let(:key) { association_key }
|
71
64
|
|
72
65
|
specify { expect(subject).to match(model_or_instance) }
|
73
|
-
|
66
|
+
|
74
67
|
describe_failure_message_when_negated do
|
75
68
|
specify { expect(subject).to eq "expected TestModel to not have a #{matcher_macro} association with :#{key}" }
|
76
69
|
end
|
@@ -81,7 +74,7 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
81
74
|
let(:actual_macro) { model.reflect_on_association(key).macro }
|
82
75
|
|
83
76
|
specify { expect(subject).to_not match(model_or_instance) }
|
84
|
-
|
77
|
+
|
85
78
|
describe_failure_message do
|
86
79
|
specify { expect(subject).to eq "expected TestModel to have a #{matcher_macro} association with :#{key}, but had a #{actual_macro} association with :#{key}" }
|
87
80
|
end
|
@@ -92,7 +85,7 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
92
85
|
let(:key) { no_association_key }
|
93
86
|
|
94
87
|
specify { expect(subject).to_not match(model_or_instance) }
|
95
|
-
|
88
|
+
|
96
89
|
describe_failure_message do
|
97
90
|
specify { expect(subject).to eq "expected TestModel to have a #{matcher_macro} association with :#{key}" }
|
98
91
|
end
|
@@ -101,4 +94,4 @@ describe Warp::ModelMatchers::AssociationMatcher, type: :model do
|
|
101
94
|
end
|
102
95
|
end
|
103
96
|
end
|
104
|
-
end
|
97
|
+
end
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Drake-Brockman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -88,9 +88,9 @@ files:
|
|
88
88
|
- spec/warp/controller_matchers/assign_matcher_spec.rb
|
89
89
|
- spec/warp/controller_matchers/set_flash_matcher_spec.rb
|
90
90
|
- spec/warp/instrument_spec.rb
|
91
|
-
- spec/warp/
|
92
|
-
- spec/warp/
|
93
|
-
- spec/warp/
|
91
|
+
- spec/warp/model_matchers/association_matcher_spec.rb
|
92
|
+
- spec/warp/model_matchers/attribute_matcher_spec.rb
|
93
|
+
- spec/warp/model_matchers/validation_matcher_spec.rb
|
94
94
|
- warp.gemspec
|
95
95
|
homepage: https://github.com/thomasfedb/warp
|
96
96
|
licenses:
|
@@ -128,6 +128,6 @@ test_files:
|
|
128
128
|
- spec/warp/controller_matchers/assign_matcher_spec.rb
|
129
129
|
- spec/warp/controller_matchers/set_flash_matcher_spec.rb
|
130
130
|
- spec/warp/instrument_spec.rb
|
131
|
-
- spec/warp/
|
132
|
-
- spec/warp/
|
133
|
-
- spec/warp/
|
131
|
+
- spec/warp/model_matchers/association_matcher_spec.rb
|
132
|
+
- spec/warp/model_matchers/attribute_matcher_spec.rb
|
133
|
+
- spec/warp/model_matchers/validation_matcher_spec.rb
|