mirage 3.0.0.alpha.15 → 3.0.0.alpha.16
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.
- data/.rvmrc +1 -1
 - data/VERSION +1 -1
 - data/features/templates/path_wildcards.feature +10 -0
 - data/mirage.gemspec +4 -3
 - data/server/mock_response.rb +4 -1
 - data/spec/server/mock_response_spec.rb +16 -0
 - metadata +5 -4
 
    
        data/.rvmrc
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            rvm --create use 1.9. 
     | 
| 
      
 1 
     | 
    
         
            +
            rvm --create use 1.9.3@mirage
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            3.0.0.alpha. 
     | 
| 
      
 1 
     | 
    
         
            +
            3.0.0.alpha.16
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Feature: URI wildcards
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              Scenario: Setting a template with wildcards
         
     | 
| 
      
 4 
     | 
    
         
            +
                Given the following Template JSON:
         
     | 
| 
      
 5 
     | 
    
         
            +
                """
         
     | 
| 
      
 6 
     | 
    
         
            +
                {"response":{"body":"SGVsbG8="}}
         
     | 
| 
      
 7 
     | 
    
         
            +
                """
         
     | 
| 
      
 8 
     | 
    
         
            +
                And the template is sent using PUT to '/templates/greeting/*/davis'
         
     | 
| 
      
 9 
     | 
    
         
            +
                When GET is sent to '/responses/greeting/leon/davis'
         
     | 
| 
      
 10 
     | 
    
         
            +
                Then 'Hello' should be returned
         
     | 
    
        data/mirage.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = "mirage"
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "3.0.0.alpha. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "3.0.0.alpha.16"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Leon Davis"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = "2013- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = "2013-10-22"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = "Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface."
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.executables = ["mirage"]
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
         @@ -52,6 +52,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       52 
52 
     | 
    
         
             
                "features/support/web.rb",
         
     | 
| 
       53 
53 
     | 
    
         
             
                "features/templates/delete.feature",
         
     | 
| 
       54 
54 
     | 
    
         
             
                "features/templates/get.feature",
         
     | 
| 
      
 55 
     | 
    
         
            +
                "features/templates/path_wildcards.feature",
         
     | 
| 
       55 
56 
     | 
    
         
             
                "features/templates/preview.feature",
         
     | 
| 
       56 
57 
     | 
    
         
             
                "features/templates/put.feature",
         
     | 
| 
       57 
58 
     | 
    
         
             
                "features/templates/put_with_substitutions.feature",
         
     | 
| 
         @@ -113,7 +114,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       113 
114 
     | 
    
         
             
              s.licenses = ["MIT"]
         
     | 
| 
       114 
115 
     | 
    
         
             
              s.post_install_message = "\n===============================================================================\nThanks you for installing mirage.   \n\nRun Mirage with:\n\nmirage start                                   \n\nFor more information go to: https://github.com/lashd/mirage/wiki\n===============================================================================\n"
         
     | 
| 
       115 
116 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       116 
     | 
    
         
            -
              s.rubygems_version = "1.8. 
     | 
| 
      
 117 
     | 
    
         
            +
              s.rubygems_version = "1.8.25"
         
     | 
| 
       117 
118 
     | 
    
         
             
              s.summary = "Mirage is a easy mock server for testing your applications"
         
     | 
| 
       118 
119 
     | 
    
         | 
| 
       119 
120 
     | 
    
         
             
              if s.respond_to? :specification_version then
         
     | 
    
        data/server/mock_response.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'binary_data_checker'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            require 'hashie/mash'
         
     | 
| 
       3 
4 
     | 
    
         
             
            module Mirage
         
     | 
| 
       4 
5 
     | 
    
         
             
              class ServerResponseNotFound < Exception
         
     | 
| 
         @@ -132,7 +133,9 @@ module Mirage 
     | 
|
| 
       132 
133 
     | 
    
         
             
                  end
         
     | 
| 
       133 
134 
     | 
    
         | 
| 
       134 
135 
     | 
    
         
             
                  def responses_for_endpoint(response)
         
     | 
| 
       135 
     | 
    
         
            -
                     
     | 
| 
      
 136 
     | 
    
         
            +
                    name = response.name
         
     | 
| 
      
 137 
     | 
    
         
            +
                    name = %r{#{name.gsub('*', '.*')}} if name =~ /\*/
         
     | 
| 
      
 138 
     | 
    
         
            +
                    responses[name]||={}
         
     | 
| 
       136 
139 
     | 
    
         
             
                  end
         
     | 
| 
       137 
140 
     | 
    
         | 
| 
       138 
141 
     | 
    
         
             
                  def responses
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'extensions/object'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'extensions/hash'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'mock_response'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            describe Mirage::MockResponse do
         
     | 
| 
         @@ -228,6 +229,21 @@ describe Mirage::MockResponse do 
     | 
|
| 
       228 
229 
     | 
    
         
             
                  end
         
     | 
| 
       229 
230 
     | 
    
         
             
                end
         
     | 
| 
       230 
231 
     | 
    
         | 
| 
      
 232 
     | 
    
         
            +
                describe 'matching request uri' do
         
     | 
| 
      
 233 
     | 
    
         
            +
                  it 'should match using wild cards' do
         
     | 
| 
      
 234 
     | 
    
         
            +
                    response_spec = convert_keys_to_strings(
         
     | 
| 
      
 235 
     | 
    
         
            +
                        {
         
     | 
| 
      
 236 
     | 
    
         
            +
                            :response => {
         
     | 
| 
      
 237 
     | 
    
         
            +
                                :body => 'response'
         
     | 
| 
      
 238 
     | 
    
         
            +
                            }
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
                        }
         
     | 
| 
      
 241 
     | 
    
         
            +
                    )
         
     | 
| 
      
 242 
     | 
    
         
            +
                    response = MockResponse.new('greeting/*/ashley/*', response_spec)
         
     | 
| 
      
 243 
     | 
    
         
            +
                    MockResponse.find(:params => {}, :headers => {}, :http_method => "get", endpoint: 'greeting/leon/ashley/davis').should == response
         
     | 
| 
      
 244 
     | 
    
         
            +
                  end
         
     | 
| 
      
 245 
     | 
    
         
            +
                end
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
       231 
247 
     | 
    
         
             
                describe 'matching against request http_headers' do
         
     | 
| 
       232 
248 
     | 
    
         
             
                  it 'should match using literals' do
         
     | 
| 
       233 
249 
     | 
    
         
             
                    required_headers = {
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mirage
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.0.0.alpha. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.0.0.alpha.16
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 6
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-10-22 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: sinatra
         
     | 
| 
         @@ -281,6 +281,7 @@ files: 
     | 
|
| 
       281 
281 
     | 
    
         
             
            - features/support/web.rb
         
     | 
| 
       282 
282 
     | 
    
         
             
            - features/templates/delete.feature
         
     | 
| 
       283 
283 
     | 
    
         
             
            - features/templates/get.feature
         
     | 
| 
      
 284 
     | 
    
         
            +
            - features/templates/path_wildcards.feature
         
     | 
| 
       284 
285 
     | 
    
         
             
            - features/templates/preview.feature
         
     | 
| 
       285 
286 
     | 
    
         
             
            - features/templates/put.feature
         
     | 
| 
       286 
287 
     | 
    
         
             
            - features/templates/put_with_substitutions.feature
         
     | 
| 
         @@ -354,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       354 
355 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       355 
356 
     | 
    
         
             
                  segments:
         
     | 
| 
       356 
357 
     | 
    
         
             
                  - 0
         
     | 
| 
       357 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 358 
     | 
    
         
            +
                  hash: 4569055939435473462
         
     | 
| 
       358 
359 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       359 
360 
     | 
    
         
             
              none: false
         
     | 
| 
       360 
361 
     | 
    
         
             
              requirements:
         
     | 
| 
         @@ -363,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       363 
364 
     | 
    
         
             
                  version: 1.3.1
         
     | 
| 
       364 
365 
     | 
    
         
             
            requirements: []
         
     | 
| 
       365 
366 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       366 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 367 
     | 
    
         
            +
            rubygems_version: 1.8.25
         
     | 
| 
       367 
368 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       368 
369 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       369 
370 
     | 
    
         
             
            summary: Mirage is a easy mock server for testing your applications
         
     |