cyrax 0.5.1.beta1 → 0.5.1.beta2
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmE3MjRhNTI5ZTliZmE0NDQ3OGRhZTY5NDU0OWU0MDAzMjg3YTljMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDAyNTU0YWJiN2Y4ODU3ODVlZTg5YzNjY2IwNWMxMWQzYjZhMTNiZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDU3MzNlYmQ5YTMyN2M3NmExMzY4YWY2MWM0ODJjOGFlYjBmODViNDAwNTM5
|
10
|
+
ZDczMjhhYWE2N2NhMjFhN2U4ODNkMmI5MTg4ZTY5NmJlNzA5OWVkYmJlNjAw
|
11
|
+
MDQyNzY0YjEzZTUzYjQ4ZDI2M2VmNjE4Nzc0OTFkNWM3MDg0NWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGNmMGJlMTU4MjUxM2U4YmQxZmU1OTJjMjU3NTNiN2JjNjk4MGUzYmZkMmFj
|
14
|
+
NjA0ZGNlN2MwYWZkNDZiZjEyNjg2YmMyMDg3MzY2MzhjODRhMmQ5MzMxYmM1
|
15
|
+
NGUxYWEwNTRlY2MyOTc0MzNhZGUyN2M0ODZiM2EwNzM5ZTU3ZGU=
|
@@ -47,7 +47,12 @@ module Cyrax::Extensions
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def set_message(message)
|
50
|
-
|
50
|
+
if message.is_a?(Symbol)
|
51
|
+
service_name = self.class.name.demodulize.underscore
|
52
|
+
@_message = I18n.t("cyrax.#{service_name}.#{message}", default: "#{response_name.titleize} successfully #{message}")
|
53
|
+
else
|
54
|
+
@_message = message
|
55
|
+
end
|
51
56
|
end
|
52
57
|
|
53
58
|
def set_status(status)
|
@@ -27,7 +27,7 @@ module Cyrax::Extensions
|
|
27
27
|
resource = build_resource(nil, custom_attributes||resource_attributes)
|
28
28
|
transaction do
|
29
29
|
if save_resource(resource)
|
30
|
-
set_message(
|
30
|
+
set_message(:created)
|
31
31
|
block.call(resource) if block_given?
|
32
32
|
end
|
33
33
|
end
|
@@ -54,7 +54,7 @@ module Cyrax::Extensions
|
|
54
54
|
resource = build_resource(params[:id], custom_attributes||resource_attributes)
|
55
55
|
transaction do
|
56
56
|
if save_resource(resource)
|
57
|
-
set_message(
|
57
|
+
set_message(:updated)
|
58
58
|
block.call(resource) if block_given?
|
59
59
|
end
|
60
60
|
end
|
@@ -15,7 +15,7 @@ module Cyrax::ControllerHelper
|
|
15
15
|
result = result.to_model if result.respond_to?(:to_model)
|
16
16
|
|
17
17
|
respond_to do |format|
|
18
|
-
format.
|
18
|
+
format.any do
|
19
19
|
# set flashes
|
20
20
|
if response.success?
|
21
21
|
flash[:notice] = options[:notice] if options[:notice].present?
|
data/lib/cyrax/version.rb
CHANGED
data/spec/cyrax/resource_spec.rb
CHANGED
@@ -91,7 +91,7 @@ module Cyrax
|
|
91
91
|
before { resource.stub(:save).and_return(true) }
|
92
92
|
|
93
93
|
it 'sets message' do
|
94
|
-
subject.should_receive(:set_message).with(
|
94
|
+
subject.should_receive(:set_message).with(:created)
|
95
95
|
subject.create(params)
|
96
96
|
end
|
97
97
|
end
|
@@ -119,7 +119,7 @@ module Cyrax
|
|
119
119
|
before { resource.stub(:save).and_return(true) }
|
120
120
|
|
121
121
|
it 'sets message' do
|
122
|
-
subject.should_receive(:set_message).with(
|
122
|
+
subject.should_receive(:set_message).with(:updated)
|
123
123
|
subject.update(params)
|
124
124
|
end
|
125
125
|
end
|
data/spec/cyrax/response_spec.rb
CHANGED
@@ -65,7 +65,7 @@ module Cyrax
|
|
65
65
|
context 'when there are errors' do
|
66
66
|
before { subject.with_errors({foo: 'some', bar: 'errors'}) }
|
67
67
|
its(:error) { should be }
|
68
|
-
its(:error) { should eq('
|
68
|
+
its(:error) { should eq('There was appeared some errors.') }
|
69
69
|
end
|
70
70
|
|
71
71
|
context 'when message is present' do
|