stitches 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e87e719f34bc52ddf14d46560ca160b073648c8
4
- data.tar.gz: 5919ab13f6949c37fb1be76f93883176d5a49a49
3
+ metadata.gz: 92db17e3cd6257c963b095a50458cfd637a259cf
4
+ data.tar.gz: 1671aa6e97c74fd316d3e3882062bd82c6a72e4c
5
5
  SHA512:
6
- metadata.gz: 123e883d8a697b656ce8c75c6a1b7fd270bfc7eba4df3b091fe12cfa17dda35f32c15b15e09a981d17bdc1564b19a265f3f01d746825b9bac80f56ba27dd54a4
7
- data.tar.gz: 8ed0e45e556b957750cf7c6eb3cb93a608909576a22e52fcd1f440be5ebeea5d19017cc40696ff9fdc3dc20067f01f4b5f8b9a23e1155df6f00ec669e4759267
6
+ metadata.gz: f6fa15947f707659a8395c34509be4f314265665311f99aa925c43d26d7a40ee78a56eedcb1605b7c9a2dabb3532244c7dabcb1c9afd0161dedceb2cb9bad6ac
7
+ data.tar.gz: db499c16dfb16a95bc605b91904918562164d838a6cc3b4c6a644768bb0d78a98f4f5839d61b37db222f048725eb7ef225b3bba1ff380c70c46d98852c9346d0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stitches (3.3.0)
4
+ stitches (3.4.0)
5
5
  apitome
6
6
  pg
7
7
  rails
@@ -11,39 +11,39 @@ PATH
11
11
  GEM
12
12
  remote: https://www.rubygems.org/
13
13
  specs:
14
- actioncable (5.0.0.1)
15
- actionpack (= 5.0.0.1)
16
- nio4r (~> 1.2)
14
+ actioncable (5.1.0)
15
+ actionpack (= 5.1.0)
16
+ nio4r (~> 2.0)
17
17
  websocket-driver (~> 0.6.1)
18
- actionmailer (5.0.0.1)
19
- actionpack (= 5.0.0.1)
20
- actionview (= 5.0.0.1)
21
- activejob (= 5.0.0.1)
18
+ actionmailer (5.1.0)
19
+ actionpack (= 5.1.0)
20
+ actionview (= 5.1.0)
21
+ activejob (= 5.1.0)
22
22
  mail (~> 2.5, >= 2.5.4)
23
23
  rails-dom-testing (~> 2.0)
24
- actionpack (5.0.0.1)
25
- actionview (= 5.0.0.1)
26
- activesupport (= 5.0.0.1)
24
+ actionpack (5.1.0)
25
+ actionview (= 5.1.0)
26
+ activesupport (= 5.1.0)
27
27
  rack (~> 2.0)
28
28
  rack-test (~> 0.6.3)
29
29
  rails-dom-testing (~> 2.0)
30
30
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
- actionview (5.0.0.1)
32
- activesupport (= 5.0.0.1)
31
+ actionview (5.1.0)
32
+ activesupport (= 5.1.0)
33
33
  builder (~> 3.1)
34
- erubis (~> 2.7.0)
34
+ erubi (~> 1.4)
35
35
  rails-dom-testing (~> 2.0)
36
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
37
- activejob (5.0.0.1)
38
- activesupport (= 5.0.0.1)
36
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
37
+ activejob (5.1.0)
38
+ activesupport (= 5.1.0)
39
39
  globalid (>= 0.3.6)
40
- activemodel (5.0.0.1)
41
- activesupport (= 5.0.0.1)
42
- activerecord (5.0.0.1)
43
- activemodel (= 5.0.0.1)
44
- activesupport (= 5.0.0.1)
45
- arel (~> 7.0)
46
- activesupport (5.0.0.1)
40
+ activemodel (5.1.0)
41
+ activesupport (= 5.1.0)
42
+ activerecord (5.1.0)
43
+ activemodel (= 5.1.0)
44
+ activesupport (= 5.1.0)
45
+ arel (~> 8.0)
46
+ activesupport (5.1.0)
47
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
48
48
  i18n (~> 0.7)
49
49
  minitest (~> 5.1)
@@ -52,96 +52,94 @@ GEM
52
52
  kramdown
53
53
  railties
54
54
  rspec_api_documentation
55
- arel (7.1.1)
56
- builder (3.2.2)
57
- concurrent-ruby (1.0.2)
58
- diff-lcs (1.2.5)
59
- erubis (2.7.0)
60
- globalid (0.3.7)
61
- activesupport (>= 4.1.0)
62
- i18n (0.7.0)
63
- kramdown (1.12.0)
55
+ arel (8.0.0)
56
+ builder (3.2.3)
57
+ concurrent-ruby (1.0.5)
58
+ diff-lcs (1.3)
59
+ erubi (1.6.0)
60
+ globalid (0.4.0)
61
+ activesupport (>= 4.2.0)
62
+ i18n (0.8.1)
63
+ kramdown (1.13.2)
64
64
  loofah (2.0.3)
65
65
  nokogiri (>= 1.5.9)
66
- mail (2.6.4)
66
+ mail (2.6.5)
67
67
  mime-types (>= 1.16, < 4)
68
68
  method_source (0.8.2)
69
69
  mime-types (3.1)
70
70
  mime-types-data (~> 3.2015)
71
71
  mime-types-data (3.2016.0521)
72
72
  mini_portile2 (2.1.0)
73
- minitest (5.9.0)
74
- mustache (1.0.3)
75
- nio4r (1.2.1)
76
- nokogiri (1.6.8)
73
+ minitest (5.10.1)
74
+ mustache (1.0.5)
75
+ nio4r (2.0.0)
76
+ nokogiri (1.7.1)
77
77
  mini_portile2 (~> 2.1.0)
78
- pkg-config (~> 1.1.7)
79
- pg (0.18.4)
80
- pkg-config (1.1.7)
81
- rack (2.0.1)
78
+ pg (0.20.0)
79
+ rack (2.0.2)
82
80
  rack-test (0.6.3)
83
81
  rack (>= 1.0)
84
- rails (5.0.0.1)
85
- actioncable (= 5.0.0.1)
86
- actionmailer (= 5.0.0.1)
87
- actionpack (= 5.0.0.1)
88
- actionview (= 5.0.0.1)
89
- activejob (= 5.0.0.1)
90
- activemodel (= 5.0.0.1)
91
- activerecord (= 5.0.0.1)
92
- activesupport (= 5.0.0.1)
82
+ rails (5.1.0)
83
+ actioncable (= 5.1.0)
84
+ actionmailer (= 5.1.0)
85
+ actionpack (= 5.1.0)
86
+ actionview (= 5.1.0)
87
+ activejob (= 5.1.0)
88
+ activemodel (= 5.1.0)
89
+ activerecord (= 5.1.0)
90
+ activesupport (= 5.1.0)
93
91
  bundler (>= 1.3.0, < 2.0)
94
- railties (= 5.0.0.1)
92
+ railties (= 5.1.0)
95
93
  sprockets-rails (>= 2.0.0)
96
- rails-dom-testing (2.0.1)
94
+ rails-dom-testing (2.0.2)
97
95
  activesupport (>= 4.2.0, < 6.0)
98
- nokogiri (~> 1.6.0)
96
+ nokogiri (~> 1.6)
99
97
  rails-html-sanitizer (1.0.3)
100
98
  loofah (~> 2.0)
101
- railties (5.0.0.1)
102
- actionpack (= 5.0.0.1)
103
- activesupport (= 5.0.0.1)
99
+ railties (5.1.0)
100
+ actionpack (= 5.1.0)
101
+ activesupport (= 5.1.0)
104
102
  method_source
105
103
  rake (>= 0.8.7)
106
104
  thor (>= 0.18.1, < 2.0)
107
- rake (11.2.2)
108
- rspec (3.5.0)
109
- rspec-core (~> 3.5.0)
110
- rspec-expectations (~> 3.5.0)
111
- rspec-mocks (~> 3.5.0)
112
- rspec-core (3.5.2)
113
- rspec-support (~> 3.5.0)
114
- rspec-expectations (3.5.0)
105
+ rake (12.0.0)
106
+ rspec (3.6.0)
107
+ rspec-core (~> 3.6.0)
108
+ rspec-expectations (~> 3.6.0)
109
+ rspec-mocks (~> 3.6.0)
110
+ rspec-core (3.6.0)
111
+ rspec-support (~> 3.6.0)
112
+ rspec-expectations (3.6.0)
115
113
  diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.5.0)
117
- rspec-mocks (3.5.0)
114
+ rspec-support (~> 3.6.0)
115
+ rspec-mocks (3.6.0)
118
116
  diff-lcs (>= 1.2.0, < 2.0)
119
- rspec-support (~> 3.5.0)
120
- rspec-rails (3.5.2)
117
+ rspec-support (~> 3.6.0)
118
+ rspec-rails (3.6.0)
121
119
  actionpack (>= 3.0)
122
120
  activesupport (>= 3.0)
123
121
  railties (>= 3.0)
124
- rspec-core (~> 3.5.0)
125
- rspec-expectations (~> 3.5.0)
126
- rspec-mocks (~> 3.5.0)
127
- rspec-support (~> 3.5.0)
128
- rspec-support (3.5.0)
129
- rspec_api_documentation (4.8.0)
122
+ rspec-core (~> 3.6.0)
123
+ rspec-expectations (~> 3.6.0)
124
+ rspec-mocks (~> 3.6.0)
125
+ rspec-support (~> 3.6.0)
126
+ rspec-support (3.6.0)
127
+ rspec_api_documentation (4.9.0)
130
128
  activesupport (>= 3.0.0)
131
129
  mustache (~> 1.0, >= 0.99.4)
132
- rspec (~> 3.0, >= 3.0.0)
133
- sprockets (3.7.0)
130
+ rspec (~> 3.0)
131
+ sprockets (3.7.1)
134
132
  concurrent-ruby (~> 1.0)
135
133
  rack (> 1, < 3)
136
134
  sprockets-rails (3.2.0)
137
135
  actionpack (>= 4.0)
138
136
  activesupport (>= 4.0)
139
137
  sprockets (>= 3.0.0)
140
- thor (0.19.1)
141
- thread_safe (0.3.5)
142
- tzinfo (1.2.2)
138
+ thor (0.19.4)
139
+ thread_safe (0.3.6)
140
+ tzinfo (1.2.3)
143
141
  thread_safe (~> 0.1)
144
- websocket-driver (0.6.4)
142
+ websocket-driver (0.6.5)
145
143
  websocket-extensions (>= 0.1.0)
146
144
  websocket-extensions (0.1.2)
147
145
 
@@ -153,4 +151,4 @@ DEPENDENCIES
153
151
  stitches!
154
152
 
155
153
  BUNDLED WITH
156
- 1.13.6
154
+ 1.14.6
data/README.md CHANGED
@@ -217,8 +217,8 @@ Stitches.configure do |config|
217
217
  end
218
218
 
219
219
  # config/application.rb
220
- config.app_middleware.use "Stitches::ApiKey", except: %r{/super-secret}
221
- config.app_middleware.use "Stitches::ValidMimeType", except: %r{/super-secret}
220
+ config.app_middleware.use Stitches::ApiKey, except: %r{/super-secret}
221
+ config.app_middleware.use Stitches::ValidMimeType, except: %r{/super-secret}
222
222
  # or whatever you want to do
223
223
  ```
224
224
 
@@ -48,7 +48,7 @@ mount api_docs, at: "docs"
48
48
  copy_file "app/models/api_client.rb"
49
49
  copy_file "config/initializers/stitches.rb"
50
50
  copy_file "lib/tasks/generate_api_key.rake"
51
- copy_file "spec/features/api_spec.rb", "spec/features/api_spec.rb"
51
+ template "spec/features/api_spec.rb.erb", "spec/features/api_spec.rb"
52
52
  copy_file "spec/acceptance/ping_v1_spec.rb", "spec/acceptance/ping_v1_spec.rb"
53
53
 
54
54
  inject_into_file "Gemfile", after: /^group :test, :development do.*$/ do<<-GEM
@@ -3,7 +3,11 @@ require 'rails_helper.rb'
3
3
  feature "general API stuff" do
4
4
  scenario "good request" do
5
5
  headers = TestHeaders.new
6
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
7
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
8
+ <% else -%>
6
9
  post "/api/ping", {}.to_json, headers.headers
10
+ <% end -%>
7
11
 
8
12
  expect(response.response_code).to eq(201)
9
13
  expect(JSON.parse(response.body)["ping"]["status"]).to eq("ok")
@@ -11,7 +15,11 @@ feature "general API stuff" do
11
15
 
12
16
  scenario "good request to v2" do
13
17
  headers = TestHeaders.new(version: 2)
18
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
19
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
20
+ <% else -%>
14
21
  post "/api/ping", {}.to_json, headers.headers
22
+ <% end -%>
15
23
 
16
24
  expect(response.response_code).to eq(201)
17
25
  expect(JSON.parse(response.body)["ping"]["status_v2"]).to eq("ok")
@@ -19,7 +27,11 @@ feature "general API stuff" do
19
27
 
20
28
  scenario "good request with custom status" do
21
29
  headers = TestHeaders.new
30
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
31
+ post("/api/ping", params: { status: 200 }.to_json, headers: headers.headers)
32
+ <% else -%>
22
33
  post "/api/ping", {status: 200}.to_json, headers.headers
34
+ <% end -%>
23
35
 
24
36
  expect(response.response_code).to eq(200)
25
37
  expect(JSON.parse(response.body)["ping"]["status"]).to eq("ok")
@@ -27,35 +39,55 @@ feature "general API stuff" do
27
39
 
28
40
  scenario "request with user error" do
29
41
  headers = TestHeaders.new
42
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
43
+ post("/api/ping", params: { error: "OH NOES!" }.to_json, headers: headers.headers)
44
+ <% else -%>
30
45
  post "/api/ping", {error: "OH NOES!"}.to_json, headers.headers
46
+ <% end -%>
31
47
 
32
48
  expect(response).to have_api_error(code: "test", message: "OH NOES!")
33
49
  end
34
50
 
35
51
  scenario "no auth header given" do
36
52
  headers = TestHeaders.new(api_client: nil)
53
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
54
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
55
+ <% else -%>
37
56
  post "/api/ping", {}.to_json, headers.headers
57
+ <% end -%>
38
58
 
39
59
  expect(response).to have_auth_error
40
60
  end
41
61
 
42
62
  scenario "weird auth header given" do
43
63
  headers = TestHeaders.new(api_client: ["Basic","foo:bar"])
64
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
65
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
66
+ <% else -%>
44
67
  post "/api/ping", {}.to_json, headers.headers
68
+ <% end -%>
45
69
 
46
70
  expect(response).to have_auth_error
47
71
  end
48
72
 
49
73
  scenario "bad key given" do
50
74
  headers = TestHeaders.new(api_client: "foobar")
75
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
76
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
77
+ <% else -%>
51
78
  post "/api/ping", {}.to_json, headers.headers
79
+ <% end -%>
52
80
 
53
81
  expect(response).to have_auth_error
54
82
  end
55
83
 
56
84
  scenario "no version" do
57
85
  headers = TestHeaders.new(version: nil)
86
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
87
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
88
+ <% else -%>
58
89
  post "/api/ping", {}.to_json, headers.headers
90
+ <% end -%>
59
91
 
60
92
  expect(response.response_code).to eq(406)
61
93
  end
@@ -63,13 +95,21 @@ feature "general API stuff" do
63
95
  scenario "version we don't support" do
64
96
  headers = TestHeaders.new(version: 999)
65
97
  expect {
98
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
99
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
100
+ <% else -%>
66
101
  post "/api/ping", {}.to_json, headers.headers
102
+ <% end -%>
67
103
  }.to raise_error(ActionController::RoutingError)
68
104
  end
69
105
 
70
106
  scenario "wrong mime type" do
71
107
  headers = TestHeaders.new(mime_type: "application/foobar")
108
+ <% if ::Rails::VERSION::MAJOR >= 5 -%>
109
+ post("/api/ping", params: {}.to_json, headers: headers.headers)
110
+ <% else -%>
72
111
  post "/api/ping", {}.to_json, headers.headers
112
+ <% end -%>
73
113
 
74
114
  expect(response.response_code).to eq(406)
75
115
  end
@@ -3,7 +3,7 @@ require 'stitches/valid_mime_type'
3
3
 
4
4
  module Stitches
5
5
  class Railtie < Rails::Railtie
6
- config.app_middleware.use "Stitches::ApiKey"
7
- config.app_middleware.use "Stitches::ValidMimeType"
6
+ config.app_middleware.use Stitches::ApiKey
7
+ config.app_middleware.use Stitches::ValidMimeType
8
8
  end
9
- end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Stitches
2
- VERSION = '3.3.0'
2
+ VERSION = '3.4.0'
3
3
  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.3.0
4
+ version: 3.4.0
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: 2017-01-10 00:00:00.000000000 Z
14
+ date: 2017-05-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -140,7 +140,7 @@ files:
140
140
  - lib/stitches/generator_files/db/migrate/enable_uuid_ossp_extension.rb
141
141
  - lib/stitches/generator_files/lib/tasks/generate_api_key.rake
142
142
  - lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb
143
- - lib/stitches/generator_files/spec/features/api_spec.rb
143
+ - lib/stitches/generator_files/spec/features/api_spec.rb.erb
144
144
  - lib/stitches/railtie.rb
145
145
  - lib/stitches/render_timestamps_in_iso8601_in_json.rb
146
146
  - lib/stitches/spec.rb