cyrax 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cyrax/extensions/has_service.rb +5 -0
- data/lib/cyrax/helpers/controller.rb +1 -1
- data/lib/cyrax/version.rb +1 -1
- data/spec/cyrax/resource_spec.rb +11 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a7df346477f2df952f07d3aecb3424e19b13309
|
4
|
+
data.tar.gz: 1a68816f86ebeaf1690af84048f9f98b54b27848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2318b14712827861174e716805c80b7e57d2793c2b7ae73b8cb0555302d7fe5a4e6f84611686c62a23c00734c7c2180e1528cff069d2cad09097c4e91b19ea50
|
7
|
+
data.tar.gz: b1c2c7e0dc9df63514c7f768e138391f9124af658bea032b71b72246d8ead5347809d53de89ae72004ab9bac9118cebf08be7e899f560b0d261064b6c50abef9
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Cyrax::Extensions
|
2
2
|
module HasService
|
3
|
+
VALIDATION_ERROR_STATUS = 422
|
3
4
|
extend ActiveSupport::Concern
|
4
5
|
|
5
6
|
# Builds and returns a collection response for Rails
|
@@ -35,6 +36,8 @@ module Cyrax::Extensions
|
|
35
36
|
if save_resource(resource)
|
36
37
|
set_message(:created)
|
37
38
|
block.call(resource) if block_given?
|
39
|
+
else
|
40
|
+
set_status VALIDATION_ERROR_STATUS
|
38
41
|
end
|
39
42
|
end
|
40
43
|
respond_with(resource)
|
@@ -63,6 +66,8 @@ module Cyrax::Extensions
|
|
63
66
|
if save_resource(resource)
|
64
67
|
set_message(:updated)
|
65
68
|
block.call(resource) if block_given?
|
69
|
+
else
|
70
|
+
set_status VALIDATION_ERROR_STATUS
|
66
71
|
end
|
67
72
|
end
|
68
73
|
respond_with(resource)
|
data/lib/cyrax/version.rb
CHANGED
data/spec/cyrax/resource_spec.rb
CHANGED
@@ -103,6 +103,11 @@ module Cyrax
|
|
103
103
|
subject.should_not_receive(:set_message).with(:created)
|
104
104
|
subject.create(params)
|
105
105
|
end
|
106
|
+
|
107
|
+
it "sets 422 status" do
|
108
|
+
subject.should_receive(:set_status).with(422)
|
109
|
+
subject.create(params)
|
110
|
+
end
|
106
111
|
end
|
107
112
|
end
|
108
113
|
|
@@ -129,7 +134,12 @@ module Cyrax
|
|
129
134
|
|
130
135
|
it 'does not set message' do
|
131
136
|
subject.should_not_receive(:set_message).with(:created)
|
132
|
-
subject.
|
137
|
+
subject.update(params)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "sets 422 status" do
|
141
|
+
subject.should_receive(:set_status).with(422)
|
142
|
+
subject.update(params)
|
133
143
|
end
|
134
144
|
end
|
135
145
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyrax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Droidlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.2.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Small library for adding service layer to Rails projects
|