infrataster 0.2.6 → 0.3.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: d3ee864e2b8c987050047a121e5393e5e2675064
4
- data.tar.gz: a08c6f86e0631d0d6446eb7392b72bae06e460c6
3
+ metadata.gz: 339c14e14bc3097da780a56abad2655524a41bb7
4
+ data.tar.gz: 306d48b65163597e6146657094b190136556c58a
5
5
  SHA512:
6
- metadata.gz: 7e0dfa862fed932ee874e9a8280df0aac2f22c5c35d6edc67e21c5aedd730f7364e4cdfceab5ea0300d8f53e09c29717c6ab890478eaa7094671aead90f81019
7
- data.tar.gz: 0e51bd096323609e8b8551b1f0c3794fe9f612131cbec563d1d64a5a860e308a8a6db51de6516ed0156ea021617e4d4ced11164e6ecddd618e6025109572b53d
6
+ metadata.gz: 13f1eafe9547319dd5eb1e36832e2dcffdbe16ab80ed516d3186b4b11966464d3762584b721932ef9c5321f7e82ffb2645bd913c99fde7a3ae79f7aa58cb013d
7
+ data.tar.gz: e8a3dff0819542807f04a178690d1cc71ff1f504f552201fa693bff4f26964a1392f18051795fb1108263e7a24d29fb51098d9990daf05c34e86d5c7a04f6b9e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Infrataster Changelog
2
2
 
3
+ ## v0.3.0
4
+
5
+ * [Fix deprecation of example_group in metadata (by @otahi)](https://github.com/ryotarai/infrataster/pull/64)
6
+
3
7
  ## v0.2.6
4
8
 
5
9
  * [Inflate response body by gzip if inflate_gzip of http resource is true.]
data/README.md CHANGED
@@ -242,6 +242,20 @@ describe server(:app) do
242
242
  # See: https://github.com/lostisland/faraday/blob/master/lib/faraday/response.rb
243
243
  end
244
244
  end
245
+
246
+ # Gzip support
247
+ describe http('http://app.example.com/gzipped') do
248
+ it "responds with content deflated by gzip" do
249
+ expect(response.headers['content-encoding']).to eq('gzip')
250
+ end
251
+ end
252
+
253
+ describe http('http://app.example.com/gzipped', inflate_gzip: true) do
254
+ it "responds with content inflated automatically" do
255
+ expect(response.headers['content-encoding']).to be_nil
256
+ expect(response.body).to eq('plain text')
257
+ end
258
+ end
245
259
  end
246
260
  ```
247
261
 
@@ -8,10 +8,10 @@ module Infrataster
8
8
  module Contexts
9
9
  class << self
10
10
  def from_example(example)
11
- example_group = example.metadata[:example_group]
11
+ eg = example_group(example)
12
12
 
13
- server_resource = find_described(Resources::ServerResource, example_group)
14
- resource = find_described(Resources::BaseResource, example_group)
13
+ server_resource = find_described(Resources::ServerResource, eg)
14
+ resource = find_described(Resources::BaseResource, eg)
15
15
 
16
16
  unless server_resource || resource
17
17
  # There is neither server_resource or resource
@@ -27,18 +27,40 @@ module Infrataster
27
27
  end
28
28
 
29
29
  private
30
+
31
+ def example_group(example)
32
+ if RSpec::Core::Version::STRING.start_with?('2')
33
+ example.metadata[:example_group]
34
+ else
35
+ example.example_group
36
+ end
37
+ end
38
+
30
39
  def find_described(resource_class, example_group)
31
- arg = example_group[:description_args].first
40
+ arg = example_group_arg(example_group)
32
41
  if arg.is_a?(resource_class)
33
42
  arg
34
43
  else
35
- parent_example_group = example_group[:example_group]
36
- if parent_example_group
37
- find_described(resource_class, parent_example_group)
38
- end
44
+ parent_eg = parent_example_group(example_group)
45
+ find_described(resource_class, parent_eg) if parent_eg
46
+ end
47
+ end
48
+
49
+ def parent_example_group(example_group)
50
+ if RSpec::Core::Version::STRING.start_with?('2')
51
+ example_group[:example_group]
52
+ else
53
+ example_group.parent_groups[1]
54
+ end
55
+ end
56
+
57
+ def example_group_arg(example_group)
58
+ if RSpec::Core::Version::STRING.start_with?('2')
59
+ example_group[:description_args].first
60
+ else
61
+ example_group.metadata[:description_args].first
39
62
  end
40
63
  end
41
64
  end
42
65
  end
43
66
  end
44
-
@@ -1,3 +1,3 @@
1
1
  module Infrataster
2
- VERSION = "0.2.6"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -14,10 +14,11 @@ Infrataster::Server.define(
14
14
  )
15
15
 
16
16
  RSpec.configure do |config|
17
- config.treat_symbols_as_metadata_keys_with_true_values = true
17
+ if RSpec::Core::Version::STRING.start_with?('2')
18
+ config.treat_symbols_as_metadata_keys_with_true_values = true
19
+ end
18
20
  config.run_all_when_everything_filtered = true
19
21
  config.filter_run :focus
20
22
 
21
23
  config.order = 'random'
22
24
  end
23
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infrataster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec