specstar-models 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specstar/models.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3c8ed030c00a7da4e805aede14a08881ee5f7ce
|
4
|
+
data.tar.gz: 7d9077c49ca65db597dbc3fc7909d585ff4191f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 726c1e6d66e5ef9254471413bda9b7dd62e1083eba2c70dd19a56603bfe5d3e2a143f2e864086a3f04ad220408de9f3b2c3b5eb2d803b6913bc1f88202a9df5d
|
7
|
+
data.tar.gz: db4dacee8193b89bcc8fe4ad96d5dde0312de174531e7951bc0958329bb227d9f33a7ea6f48dedfd0abeb7e331e60a04e843253e5533ecb17ba79e6a98ac1d43
|
data/lib/specstar/models.rb
CHANGED
@@ -157,6 +157,18 @@ module Specstar
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
160
|
+
|
161
|
+
RSpec::Matchers.define :belong_to do |attr|
|
162
|
+
match do |model|
|
163
|
+
association = model.class.reflect_on_association(attr)
|
164
|
+
association && association.macro == :belongs_to
|
165
|
+
end
|
166
|
+
|
167
|
+
failure_message do |model|
|
168
|
+
"expected #{model.class} to belong to #{attr}."
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
160
172
|
end
|
161
173
|
end
|
162
174
|
end
|