Sha256: dce3310dcbbfa95ef1f01c1c82b4e14442e30d59801bb27f0f35c0ae088d3a86

Contents?: true

Size: 1.61 KB

Versions: 6

Compression:

Stored size: 1.61 KB

Contents

Feature: The client can be configured with default settings to keep your mocking 'DRY'

  Background:
    Given the following gems are required to run the Mirage client test code:
    """
    require 'rubygems'
    require 'rspec'
    require 'mirage/client'
    """

  Scenario: configuring the client on instance
    Given I run
    """
    client = Mirage::Client.new do
      http_method :post
      status 202
      default true
      delay 2
      content_type "text/xml"
    end

    client.put('greeting','hello')
    """
    When POST is sent to '/responses/greeting/for/someone'
    Then 'hello' should be returned
    And a 202 should be returned
    Then it should take at least '2' seconds
    And the response 'content-type' should be 'text/xml'

  Scenario: Configuring a client after it has been created
    Given I run
    """
    client = Mirage::Client.new
    client.configure do
      http_method :post
      status 202
      default false
      delay 2
      content_type "text/xml"
    end

    client.put('greeting','hello')
    """
    When POST is sent to '/responses/greeting'
    Then 'hello' should be returned
    And a 202 should be returned
    Then it should take at least '2' seconds
    And the response 'content-type' should be 'text/xml'

  Scenario: resetting defaults
    Given I run
    """
    client = Mirage::Client.new
    client.configure do
      http_method :post
      status 202
      default true
      delay 2
      content_type "text/xml"
    end

    client.reset
    client.put('greeting','hello')
    """
    When GET is sent to '/responses/greeting'
    Then 'hello' should be returned




Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mirage-3.0.0.alpha.17 features/client/configure.feature
mirage-3.0.0.alpha.16 features/client/configure.feature
mirage-3.0.0.alpha.15 features/client/configure.feature
mirage-3.0.0.alpha.14 features/client/configure.feature
mirage-3.0.0.alpha.13 features/client/configure.feature
mirage-3.0.0.alpha.12 features/client/configure.feature