infrataster 0.2.6 → 0.3.0
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/CHANGELOG.md +4 -0
- data/README.md +14 -0
- data/lib/infrataster/contexts.rb +31 -9
- data/lib/infrataster/version.rb +1 -1
- data/spec/integration/spec_helper.rb +3 -2
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 339c14e14bc3097da780a56abad2655524a41bb7
         | 
| 4 | 
            +
              data.tar.gz: 306d48b65163597e6146657094b190136556c58a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 13f1eafe9547319dd5eb1e36832e2dcffdbe16ab80ed516d3186b4b11966464d3762584b721932ef9c5321f7e82ffb2645bd913c99fde7a3ae79f7aa58cb013d
         | 
| 7 | 
            +
              data.tar.gz: e8a3dff0819542807f04a178690d1cc71ff1f504f552201fa693bff4f26964a1392f18051795fb1108263e7a24d29fb51098d9990daf05c34e86d5c7a04f6b9e
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        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 |  | 
    
        data/lib/infrataster/contexts.rb
    CHANGED
    
    | @@ -8,10 +8,10 @@ module Infrataster | |
| 8 8 | 
             
              module Contexts
         | 
| 9 9 | 
             
                class << self
         | 
| 10 10 | 
             
                  def from_example(example)
         | 
| 11 | 
            -
                     | 
| 11 | 
            +
                    eg = example_group(example)
         | 
| 12 12 |  | 
| 13 | 
            -
                    server_resource = find_described(Resources::ServerResource,  | 
| 14 | 
            -
                    resource = find_described(Resources::BaseResource,  | 
| 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 | 
| 40 | 
            +
                    arg = example_group_arg(example_group)
         | 
| 32 41 | 
             
                    if arg.is_a?(resource_class)
         | 
| 33 42 | 
             
                      arg
         | 
| 34 43 | 
             
                    else
         | 
| 35 | 
            -
                       | 
| 36 | 
            -
                      if  | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 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 | 
            -
             | 
    
        data/lib/infrataster/version.rb
    CHANGED
    
    
| @@ -14,10 +14,11 @@ Infrataster::Server.define( | |
| 14 14 | 
             
            )
         | 
| 15 15 |  | 
| 16 16 | 
             
            RSpec.configure do |config|
         | 
| 17 | 
            -
               | 
| 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. | 
| 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- | 
| 11 | 
            +
            date: 2015-06-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rspec
         |