Sha256: f1605d7a282cfc75470a88765de25b1b5faba1777f42576dcf3f2ba5f6b2a27c

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

Given /^rest\-assured is running locally:$/ do |code|
  eval code
end

When /^that double gets requested:$/ do |code|
  eval code
end

When /^I request call history for that double:$/ do |code|
  eval code
end

Then /^I should see history records for those requests:$/ do |code|
  eval code
end

Then /^it should be empty:$/ do |code|
  eval code
end

Given /^I created? a double:$/ do |string|
  # expected string is:
  # @double = RestAssured::Double.create(:fullpath => '/some/api', :verb => 'POST')
  eval string
end

When /^that double gets requested (#{CAPTURE_A_NUMBER}) times$/ do |num|
  num.times do
    sleep 0.5
    send(@double.verb.downcase, @double.fullpath)
  end
end

When /^I wait for (\d+) requests:$/ do |num, string|
  # expected string
  # @double.wait_for_requests(3)

  @wait_start = Time.now
  @t = Thread.new do
    begin
      eval string
    rescue RestAssured::MoreRequestsExpected => e
      @more_reqs_exc = e
    end
  end
end

Then /^it should let me through$/ do
  @t.join
  @more_reqs_exc.should == nil
end

Then /^it should wait for (#{CAPTURE_A_NUMBER}) seconds(?: \(default timeout\))?$/ do |timeout|
  @t.join
  wait_time = Time.now - @wait_start
  #(timeout..(timeout+1)).should cover(wait_time) # cover() only avilable in 1.9
  wait_time.should >= timeout
  wait_time.should < timeout + 1
end

Then /^it should raise MoreRequestsExpected error after with the following message:$/ do |string|
  @more_reqs_exc.should be_instance_of RestAssured::MoreRequestsExpected
  @more_reqs_exc.message.should =~ /#{string}/
end

Then /^the following should be true:$/ do |code|
  eval code
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rest-assured-0.3.2 features/step_definitions/ruby_api_steps.rb
rest-assured-0.3.1 features/step_definitions/ruby_api_steps.rb