stitches 3.2.2 → 3.2.3
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/.ruby-version +1 -1
- data/Gemfile.lock +67 -65
- data/README.md +1 -1
- data/lib/stitches/spec/have_api_error.rb +4 -7
- data/lib/stitches/version.rb +1 -1
- data/spec/spec/have_api_error_spec.rb +78 -4
- 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: a861f11796bfcc697ded1857fe96d0b0dfbc73ab
|
|
4
|
+
data.tar.gz: 831d978bdf931a550a6af1fe1779e8216f6f56b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd50b87dbe2f27d96d287de362ff8ae19479b3c47793d1700d988597b88b408f2ffa56fd4d29ab5a905336fce67fab4824b6caf342d9175f8ad8e11dad702240
|
|
7
|
+
data.tar.gz: 1df173eeecc1a8e16640ab1b50c5fe2d406180f381414c6fd1ff606a2a959f56970377f99236c0b9c456b8a1a233c5aa95923af5d5b955cf828bc29cc7951a53
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.3.0
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
stitches (3.2.
|
|
4
|
+
stitches (3.2.3)
|
|
5
5
|
apitome
|
|
6
6
|
pg
|
|
7
7
|
rails
|
|
@@ -11,36 +11,36 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://www.rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
actionmailer (4.2.
|
|
15
|
-
actionpack (= 4.2.
|
|
16
|
-
actionview (= 4.2.
|
|
17
|
-
activejob (= 4.2.
|
|
14
|
+
actionmailer (4.2.5.2)
|
|
15
|
+
actionpack (= 4.2.5.2)
|
|
16
|
+
actionview (= 4.2.5.2)
|
|
17
|
+
activejob (= 4.2.5.2)
|
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
|
19
19
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
20
|
-
actionpack (4.2.
|
|
21
|
-
actionview (= 4.2.
|
|
22
|
-
activesupport (= 4.2.
|
|
20
|
+
actionpack (4.2.5.2)
|
|
21
|
+
actionview (= 4.2.5.2)
|
|
22
|
+
activesupport (= 4.2.5.2)
|
|
23
23
|
rack (~> 1.6)
|
|
24
24
|
rack-test (~> 0.6.2)
|
|
25
25
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
-
actionview (4.2.
|
|
28
|
-
activesupport (= 4.2.
|
|
27
|
+
actionview (4.2.5.2)
|
|
28
|
+
activesupport (= 4.2.5.2)
|
|
29
29
|
builder (~> 3.1)
|
|
30
30
|
erubis (~> 2.7.0)
|
|
31
31
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
32
32
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
33
|
-
activejob (4.2.
|
|
34
|
-
activesupport (= 4.2.
|
|
33
|
+
activejob (4.2.5.2)
|
|
34
|
+
activesupport (= 4.2.5.2)
|
|
35
35
|
globalid (>= 0.3.0)
|
|
36
|
-
activemodel (4.2.
|
|
37
|
-
activesupport (= 4.2.
|
|
36
|
+
activemodel (4.2.5.2)
|
|
37
|
+
activesupport (= 4.2.5.2)
|
|
38
38
|
builder (~> 3.1)
|
|
39
|
-
activerecord (4.2.
|
|
40
|
-
activemodel (= 4.2.
|
|
41
|
-
activesupport (= 4.2.
|
|
39
|
+
activerecord (4.2.5.2)
|
|
40
|
+
activemodel (= 4.2.5.2)
|
|
41
|
+
activesupport (= 4.2.5.2)
|
|
42
42
|
arel (~> 6.0)
|
|
43
|
-
activesupport (4.2.
|
|
43
|
+
activesupport (4.2.5.2)
|
|
44
44
|
i18n (~> 0.7)
|
|
45
45
|
json (~> 1.7, >= 1.7.7)
|
|
46
46
|
minitest (~> 5.1)
|
|
@@ -52,84 +52,86 @@ GEM
|
|
|
52
52
|
rspec_api_documentation
|
|
53
53
|
arel (6.0.3)
|
|
54
54
|
builder (3.2.2)
|
|
55
|
+
concurrent-ruby (1.0.1)
|
|
55
56
|
diff-lcs (1.2.5)
|
|
56
57
|
erubis (2.7.0)
|
|
57
58
|
globalid (0.3.6)
|
|
58
59
|
activesupport (>= 4.1.0)
|
|
59
60
|
i18n (0.7.0)
|
|
60
61
|
json (1.8.3)
|
|
61
|
-
kramdown (1.
|
|
62
|
-
loofah (2.0.
|
|
62
|
+
kramdown (1.10.0)
|
|
63
|
+
loofah (2.0.3)
|
|
63
64
|
nokogiri (>= 1.5.9)
|
|
64
65
|
mail (2.6.3)
|
|
65
66
|
mime-types (>= 1.16, < 3)
|
|
66
|
-
mime-types (2.
|
|
67
|
-
|
|
68
|
-
minitest (5.8.
|
|
67
|
+
mime-types (2.99.1)
|
|
68
|
+
mini_portile2 (2.0.0)
|
|
69
|
+
minitest (5.8.4)
|
|
69
70
|
mustache (0.99.8)
|
|
70
|
-
nokogiri (1.6.
|
|
71
|
-
|
|
72
|
-
pg (0.18.
|
|
71
|
+
nokogiri (1.6.7.2)
|
|
72
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
73
|
+
pg (0.18.4)
|
|
73
74
|
rack (1.6.4)
|
|
74
75
|
rack-test (0.6.3)
|
|
75
76
|
rack (>= 1.0)
|
|
76
|
-
rails (4.2.
|
|
77
|
-
actionmailer (= 4.2.
|
|
78
|
-
actionpack (= 4.2.
|
|
79
|
-
actionview (= 4.2.
|
|
80
|
-
activejob (= 4.2.
|
|
81
|
-
activemodel (= 4.2.
|
|
82
|
-
activerecord (= 4.2.
|
|
83
|
-
activesupport (= 4.2.
|
|
77
|
+
rails (4.2.5.2)
|
|
78
|
+
actionmailer (= 4.2.5.2)
|
|
79
|
+
actionpack (= 4.2.5.2)
|
|
80
|
+
actionview (= 4.2.5.2)
|
|
81
|
+
activejob (= 4.2.5.2)
|
|
82
|
+
activemodel (= 4.2.5.2)
|
|
83
|
+
activerecord (= 4.2.5.2)
|
|
84
|
+
activesupport (= 4.2.5.2)
|
|
84
85
|
bundler (>= 1.3.0, < 2.0)
|
|
85
|
-
railties (= 4.2.
|
|
86
|
+
railties (= 4.2.5.2)
|
|
86
87
|
sprockets-rails
|
|
87
88
|
rails-deprecated_sanitizer (1.0.3)
|
|
88
89
|
activesupport (>= 4.2.0.alpha)
|
|
89
|
-
rails-dom-testing (1.0.
|
|
90
|
+
rails-dom-testing (1.0.7)
|
|
90
91
|
activesupport (>= 4.2.0.beta, < 5.0)
|
|
91
92
|
nokogiri (~> 1.6.0)
|
|
92
93
|
rails-deprecated_sanitizer (>= 1.0.1)
|
|
93
|
-
rails-html-sanitizer (1.0.
|
|
94
|
+
rails-html-sanitizer (1.0.3)
|
|
94
95
|
loofah (~> 2.0)
|
|
95
|
-
railties (4.2.
|
|
96
|
-
actionpack (= 4.2.
|
|
97
|
-
activesupport (= 4.2.
|
|
96
|
+
railties (4.2.5.2)
|
|
97
|
+
actionpack (= 4.2.5.2)
|
|
98
|
+
activesupport (= 4.2.5.2)
|
|
98
99
|
rake (>= 0.8.7)
|
|
99
100
|
thor (>= 0.18.1, < 2.0)
|
|
100
|
-
rake (10.
|
|
101
|
-
rspec (3.
|
|
102
|
-
rspec-core (~> 3.
|
|
103
|
-
rspec-expectations (~> 3.
|
|
104
|
-
rspec-mocks (~> 3.
|
|
105
|
-
rspec-core (3.3
|
|
106
|
-
rspec-support (~> 3.
|
|
107
|
-
rspec-expectations (3.
|
|
101
|
+
rake (10.5.0)
|
|
102
|
+
rspec (3.4.0)
|
|
103
|
+
rspec-core (~> 3.4.0)
|
|
104
|
+
rspec-expectations (~> 3.4.0)
|
|
105
|
+
rspec-mocks (~> 3.4.0)
|
|
106
|
+
rspec-core (3.4.3)
|
|
107
|
+
rspec-support (~> 3.4.0)
|
|
108
|
+
rspec-expectations (3.4.0)
|
|
108
109
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
109
|
-
rspec-support (~> 3.
|
|
110
|
-
rspec-mocks (3.
|
|
110
|
+
rspec-support (~> 3.4.0)
|
|
111
|
+
rspec-mocks (3.4.1)
|
|
111
112
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
112
|
-
rspec-support (~> 3.
|
|
113
|
-
rspec-rails (3.
|
|
113
|
+
rspec-support (~> 3.4.0)
|
|
114
|
+
rspec-rails (3.4.2)
|
|
114
115
|
actionpack (>= 3.0, < 4.3)
|
|
115
116
|
activesupport (>= 3.0, < 4.3)
|
|
116
117
|
railties (>= 3.0, < 4.3)
|
|
117
|
-
rspec-core (~> 3.
|
|
118
|
-
rspec-expectations (~> 3.
|
|
119
|
-
rspec-mocks (~> 3.
|
|
120
|
-
rspec-support (~> 3.
|
|
121
|
-
rspec-support (3.
|
|
122
|
-
rspec_api_documentation (4.
|
|
118
|
+
rspec-core (~> 3.4.0)
|
|
119
|
+
rspec-expectations (~> 3.4.0)
|
|
120
|
+
rspec-mocks (~> 3.4.0)
|
|
121
|
+
rspec-support (~> 3.4.0)
|
|
122
|
+
rspec-support (3.4.1)
|
|
123
|
+
rspec_api_documentation (4.7.0)
|
|
123
124
|
activesupport (>= 3.0.0)
|
|
124
125
|
json (~> 1.4, >= 1.4.6)
|
|
125
126
|
mustache (~> 0.99, >= 0.99.4)
|
|
126
127
|
rspec (>= 3.0.0)
|
|
127
|
-
sprockets (3.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
sprockets (3.5.2)
|
|
129
|
+
concurrent-ruby (~> 1.0)
|
|
130
|
+
rack (> 1, < 3)
|
|
131
|
+
sprockets-rails (3.0.4)
|
|
132
|
+
actionpack (>= 4.0)
|
|
133
|
+
activesupport (>= 4.0)
|
|
134
|
+
sprockets (>= 3.0.0)
|
|
133
135
|
thor (0.19.1)
|
|
134
136
|
thread_safe (0.3.5)
|
|
135
137
|
tzinfo (1.2.2)
|
|
@@ -143,4 +145,4 @@ DEPENDENCIES
|
|
|
143
145
|
stitches!
|
|
144
146
|
|
|
145
147
|
BUNDLED WITH
|
|
146
|
-
1.
|
|
148
|
+
1.11.2
|
data/README.md
CHANGED
|
@@ -31,16 +31,13 @@ RSpec::Matchers.define :have_api_error do |expected_fields|
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
failure_message do |response|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
expected_status = (expected_fields[:status] || 422)
|
|
35
|
+
if response.response_code != expected_status
|
|
36
|
+
"HTTP status was #{response.response_code} and not #{expected_status}"
|
|
36
37
|
else
|
|
37
38
|
error = extract_error(response,expected_fields)
|
|
38
39
|
if error
|
|
39
|
-
|
|
40
|
-
"Expected code to be '#{expected_fields[:code]}', but was '#{error['code']}'"
|
|
41
|
-
else
|
|
42
|
-
"Expected message to be '#{expected_fields[:message]}', but was '#{error['message']}'"
|
|
43
|
-
end
|
|
40
|
+
"Expected message to be '#{expected_fields[:message]}', but was '#{error['message']}'"
|
|
44
41
|
else
|
|
45
42
|
"Could not find an error for code #{expected_fields[:code]} from #{response.body}"
|
|
46
43
|
end
|
data/lib/stitches/version.rb
CHANGED
|
@@ -8,6 +8,7 @@ describe "have_api_error" do
|
|
|
8
8
|
{ code: "baz", message: "quux" }
|
|
9
9
|
]
|
|
10
10
|
}
|
|
11
|
+
let(:response_code) { 422 }
|
|
11
12
|
let(:response) {
|
|
12
13
|
double(
|
|
13
14
|
response_code: response_code,
|
|
@@ -60,10 +61,31 @@ describe "have_api_error" do
|
|
|
60
61
|
context "expected status is specified" do
|
|
61
62
|
context "status is the expected status" do
|
|
62
63
|
let(:response_code) { 404 }
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
context "there is an error" do
|
|
65
|
+
it "indicates there is an error" do
|
|
66
|
+
expect(response).to have_api_error(status: 404,
|
|
67
|
+
code: errors.first[:code],
|
|
68
|
+
message: errors.first[:message])
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
context "there is not an error" do
|
|
72
|
+
context "and the status code is what's wrong" do
|
|
73
|
+
let(:response) {
|
|
74
|
+
double(
|
|
75
|
+
response_code: 401,
|
|
76
|
+
body: { errors: errors }.to_json)
|
|
77
|
+
}
|
|
78
|
+
it "fails the test" do
|
|
79
|
+
begin
|
|
80
|
+
expect(response).to have_api_error(status: 404,
|
|
81
|
+
code: errors.first[:code],
|
|
82
|
+
message: errors.first[:message])
|
|
83
|
+
rescue Exception => ex
|
|
84
|
+
expect(ex.class).to eq(RSpec::Expectations::ExpectationNotMetError)
|
|
85
|
+
expect(ex.message).to match(/HTTP status was 401 and not 404/i)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
67
89
|
end
|
|
68
90
|
end
|
|
69
91
|
context "status is not the expected status" do
|
|
@@ -74,5 +96,57 @@ describe "have_api_error" do
|
|
|
74
96
|
message: errors.first[:bar])
|
|
75
97
|
end
|
|
76
98
|
end
|
|
99
|
+
context "response errors don't match expectations" do
|
|
100
|
+
context "because the status code is what's wrong" do
|
|
101
|
+
let(:response) {
|
|
102
|
+
double(
|
|
103
|
+
response_code: 401,
|
|
104
|
+
body: { errors: errors }.to_json)
|
|
105
|
+
}
|
|
106
|
+
it "fails the test" do
|
|
107
|
+
begin
|
|
108
|
+
expect(response).to have_api_error(code: errors.first[:code],
|
|
109
|
+
message: errors.first[:message])
|
|
110
|
+
rescue Exception => ex
|
|
111
|
+
expect(ex.class).to eq(RSpec::Expectations::ExpectationNotMetError)
|
|
112
|
+
expect(ex.message).to match(/HTTP status was 401 and not 422/i)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
context "because there is no matching code" do
|
|
117
|
+
let(:errors) {
|
|
118
|
+
[
|
|
119
|
+
{ code: "foo", message: "bar" },
|
|
120
|
+
{ code: "baz", message: "quux" }
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
it "fails the test" do
|
|
124
|
+
begin
|
|
125
|
+
expect(response).to have_api_error(code: errors.first[:code] + "blah",
|
|
126
|
+
message: errors.first[:message])
|
|
127
|
+
rescue Exception => ex
|
|
128
|
+
expect(ex.class).to eq(RSpec::Expectations::ExpectationNotMetError)
|
|
129
|
+
expect(ex.message).to match(/Could not find an error for code/i)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
context "because there is no matching message" do
|
|
134
|
+
let(:errors) {
|
|
135
|
+
[
|
|
136
|
+
{ code: "foo", message: "bar" },
|
|
137
|
+
{ code: "baz", message: "quux" }
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
it "fails the test" do
|
|
141
|
+
begin
|
|
142
|
+
expect(response).to have_api_error(code: errors.first[:code],
|
|
143
|
+
message: errors.first[:message] + "blah")
|
|
144
|
+
rescue Exception => ex
|
|
145
|
+
expect(ex.class).to eq(RSpec::Expectations::ExpectationNotMetError)
|
|
146
|
+
expect(ex.message).to match(/Expected message to be/i)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
77
151
|
end
|
|
78
152
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stitches
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.2.
|
|
4
|
+
version: 3.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stitch Fix Engineering
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rails
|
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
179
|
version: '0'
|
|
180
180
|
requirements: []
|
|
181
181
|
rubyforge_project:
|
|
182
|
-
rubygems_version: 2.
|
|
182
|
+
rubygems_version: 2.6.6
|
|
183
183
|
signing_key:
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: You'll be in stitches at how easy it is to create a service at Stitch Fix
|