grape-juice 0.0.1 → 0.0.2
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 +4 -4
- data/lib/grape_juice/expose_matcher.rb +12 -0
- data/lib/grape_juice/version.rb +1 -1
- data/spec/grape_juice/expose_matcher_spec.rb +6 -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: c094b2c33c2a7268f4ba241c9f97d69bbd672d02
|
4
|
+
data.tar.gz: 787f98eb95fade70d32a4b8876cd4a1e6e56eb1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bd40fce4c4f073bbdc3ccd70330e67d65dd5fb490f566f21f1cc5c097003f1181ceb5574739a352f7ee971aefe0a4143c7b3e0674ce3a9f9192044459311b57
|
7
|
+
data.tar.gz: 216ba12793f24b3be414bce95fa9f1a03cf747d76d8f37ac2c6c37cd40b2dfe8329c35706be8e586409530261897cf403257b00978ee5d31a5e4aca80a2e136c
|
@@ -19,6 +19,7 @@ module GrapeJuice
|
|
19
19
|
as_correct? &&
|
20
20
|
if_conditions_correct? &&
|
21
21
|
unless_conditions_correct? &&
|
22
|
+
using_correct? &&
|
22
23
|
format_correct? &&
|
23
24
|
safe_correct?
|
24
25
|
end
|
@@ -132,6 +133,17 @@ module GrapeJuice
|
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
136
|
+
def using_correct?
|
137
|
+
return true if @using_entity.nil?
|
138
|
+
|
139
|
+
if exposure[:using] != @using_entity
|
140
|
+
@failure_message = "Expected to use #{@using_entity} for exposure, but got #{exposure[:using] || 'nil'}"
|
141
|
+
false
|
142
|
+
else
|
143
|
+
true
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
135
147
|
def format_correct?
|
136
148
|
return true if @formatter.nil?
|
137
149
|
|
data/lib/grape_juice/version.rb
CHANGED
@@ -3,13 +3,19 @@ require 'spec_helper'
|
|
3
3
|
describe GrapeJuice::ExposeMatcher do
|
4
4
|
|
5
5
|
context "rspec integration" do
|
6
|
+
class AddressEntity
|
7
|
+
end
|
6
8
|
class PersonEntity < Grape::Entity
|
7
9
|
expose :name
|
10
|
+
|
11
|
+
expose :address, using: AddressEntity
|
12
|
+
|
8
13
|
end
|
9
14
|
|
10
15
|
subject { PersonEntity }
|
11
16
|
|
12
17
|
|
13
18
|
it { is_expected.to expose(:name) }
|
19
|
+
it { is_expected.to expose(:address).using(AddressEntity) }
|
14
20
|
end
|
15
21
|
end
|