fson 0.0.3 → 0.0.4
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/README.md +1 -1
- data/lib/fson/response.rb +1 -1
- data/lib/fson/version.rb +1 -1
- data/spec/fson/response/{to_json_spec.rb → as_json_spec.rb} +2 -1
- data/spec/fson/response/error_spec.rb +8 -5
- data/spec/fson/response/fail_spec.rb +8 -5
- data/spec/fson/response/initialize_spec.rb +8 -5
- data/spec/fson/response/success_spec.rb +8 -5
- 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: 17bfd7f187015864d738f9b5a460bdefd845eb25
|
4
|
+
data.tar.gz: 843bc84ed8bbb0f326cc8e66a709dec22649d9fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d09d1d708e8b03065375ded5bdf6e7e5688710ccb05b699d35608e4361dd5fcc5160058f8353287601cdc6b34bd1f463a7594ab19d7bb74fc4f057122b57a79d
|
7
|
+
data.tar.gz: ab36d815a9db5df6923f49fe7bfa6f4389e7ad67f4609697e00c404775533057749c881392d550f341785441b47fa9fb935aee1651df6309ea2aee40be3adfd8
|
data/README.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
#
|
1
|
+
# Fson - JSON API Response Fluent Builder
|
data/lib/fson/response.rb
CHANGED
data/lib/fson/version.rb
CHANGED
@@ -3,6 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ::Fson::Response do
|
4
4
|
|
5
5
|
context 'when getting json representation of response' do
|
6
|
+
|
6
7
|
it 'should return json response' do
|
7
8
|
# given
|
8
9
|
response = ::Fson::Response.error
|
@@ -10,7 +11,7 @@ describe ::Fson::Response do
|
|
10
11
|
.data { |data| data[:author] = 'Mateusz Kluczny' }
|
11
12
|
|
12
13
|
# when/then
|
13
|
-
expect(response.
|
14
|
+
expect(response.as_json).to eq("{\":status\":\":error\",\":data\":{\":author\":\"Mateusz Kluczny\"},\":errors\":[{\":message\":\"invalid\",\":id\":\"text-set-1\"}]}")
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -2,11 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ::Fson::Response do
|
4
4
|
|
5
|
-
|
6
|
-
# when
|
7
|
-
response = Fson::Response.error
|
5
|
+
context 'when creating response' do
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
it 'should create error response' do
|
8
|
+
# when
|
9
|
+
response = Fson::Response.error
|
10
|
+
|
11
|
+
# then
|
12
|
+
expect(response.instance_eval {@_response[:status]}).to eq(:error)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
@@ -2,11 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ::Fson::Response do
|
4
4
|
|
5
|
-
|
6
|
-
# when
|
7
|
-
response = Fson::Response.fail
|
5
|
+
context 'when creating response' do
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
it 'should create fail response' do
|
8
|
+
# when
|
9
|
+
response = Fson::Response.fail
|
10
|
+
|
11
|
+
# then
|
12
|
+
expect(response.instance_eval {@_response[:status]}).to eq(:fail)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
@@ -2,11 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ::Fson::Response do
|
4
4
|
|
5
|
-
|
6
|
-
# when
|
7
|
-
response = Fson::Response.new(:success)
|
5
|
+
context 'when creating response' do
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
it 'should create response object with given status' do
|
8
|
+
# when
|
9
|
+
response = Fson::Response.new(:success)
|
10
|
+
|
11
|
+
# then
|
12
|
+
expect(response.instance_eval {@_response[:status]}).to eq(:success)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
@@ -2,11 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ::Fson::Response do
|
4
4
|
|
5
|
-
|
6
|
-
# when
|
7
|
-
response = Fson::Response.success
|
5
|
+
context 'when creating response' do
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
it 'should create success response' do
|
8
|
+
# when
|
9
|
+
response = Fson::Response.success
|
10
|
+
|
11
|
+
# then
|
12
|
+
expect(response.instance_eval {@_response[:status]}).to eq(:success)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Kluczny
|
@@ -69,11 +69,11 @@ files:
|
|
69
69
|
- lib/fson/builder.rb
|
70
70
|
- lib/fson/response.rb
|
71
71
|
- lib/fson/version.rb
|
72
|
+
- spec/fson/response/as_json_spec.rb
|
72
73
|
- spec/fson/response/error_spec.rb
|
73
74
|
- spec/fson/response/fail_spec.rb
|
74
75
|
- spec/fson/response/initialize_spec.rb
|
75
76
|
- spec/fson/response/success_spec.rb
|
76
|
-
- spec/fson/response/to_json_spec.rb
|
77
77
|
- spec/spec_helper.rb
|
78
78
|
homepage: https://github.com/mkluczny/fson
|
79
79
|
licenses:
|
@@ -100,9 +100,9 @@ signing_key:
|
|
100
100
|
specification_version: 4
|
101
101
|
summary: Simple fluent builder for API JSON responses
|
102
102
|
test_files:
|
103
|
+
- spec/fson/response/as_json_spec.rb
|
103
104
|
- spec/fson/response/error_spec.rb
|
104
105
|
- spec/fson/response/fail_spec.rb
|
105
106
|
- spec/fson/response/initialize_spec.rb
|
106
107
|
- spec/fson/response/success_spec.rb
|
107
|
-
- spec/fson/response/to_json_spec.rb
|
108
108
|
- spec/spec_helper.rb
|