Sha256: 0d49b5e88ff0afd04f90086fe1be650dea75c0b800e3e0d509241472af23329a

Contents?: true

Size: 1.94 KB

Versions: 5

Compression:

Stored size: 1.94 KB

Contents

@ruby_api
Feature: create double
  As ruby developer
  I want to be able to create doubles via client api
  So that interactions with rest-assured server are completely hidden from me

  Scenario: default options
    When I create a double:
    """
    @double = RestAssured::Double.create(:fullpath => '/some/api')
    """
    Then the following should be true:
    """
    @double.verb.should             == 'GET'
    @double.response_headers.should == {}
    @double.status.should           == 200
    @double.content.should          == nil

    get @double.fullpath
    last_response.should be_ok
    """

  Scenario: specify response headers
    When I create a double:
    """
    @double = RestAssured::Double.create(:fullpath => '/some/api', :response_headers => { 'Content-Type' => 'text/html' })
    """
    Then the following should be true:
    """
    @double.response_headers.should == { 'Content-Type' => 'text/html' }

    get @double.fullpath
    last_response.headers['Content-Type'].should == 'text/html'
    """

  Scenario: specify content
    When I create a double:
    """
    @double = RestAssured::Double.create(:fullpath => '/some/api', :content => 'awesome')
    """
    Then the following should be true:
    """
    @double.content = 'awesome'

    get @double.fullpath
    last_response.body == 'awesome'
    """

  Scenario: specify verb
    When I create a double:
    """
    @double = RestAssured::Double.create(:fullpath => '/some/api', :verb => 'POST')
    """
    Then the following should be true:
    """
    @double.verb = 'POST'

    get @double.fullpath
    last_response.should_not be_ok

    post @double.fullpath
    last_response.should be_ok
    """

  Scenario: specify status
    When I create a double:
    """
    @double = RestAssured::Double.create(:fullpath => '/some/api', :status => 302)
    """
    Then the following should be true:
    """
    @double.status = 302

    get @double.fullpath
    last_response.status == 302
    """

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rest-assured-1.1.1 features/ruby_api/create_double.feature
rest-assured-1.1.0 features/ruby_api/create_double.feature
rest-assured-1.0.0 features/ruby_api/create_double.feature
rest-assured-1.0.0.rc2 features/ruby_api/create_double.feature
rest-assured-1.0.0.rc1 features/ruby_api/create_double.feature