Sha256: 7d50ad077f4f76945df217a1d94e4218645a05f32fbce94f25700f646737d7aa

Contents?: true

Size: 1.62 KB

Versions: 9

Compression:

Stored size: 1.62 KB

Contents

Given /^I have github instance$/ do
  @github = Github.new
end

Given /^I have "([^"]*)" instance$/ do |api_classes|
  @instance = convert_to_constant(api_classes).new
end

When /^I fetch "([^"]*)"$/ do |method|
  @response = @github.send(method.to_sym)
end

When /^I will have access to "([^"]*)" API$/ do |api|
  @response.class.to_s.should match api
end

When /^I am looking for "([^"]*)"$/ do |method|
  @method = method
end

When /^I pass the following request options:$/ do |table|
  table.hashes.each do |options|
    @options = options
  end
end

When /^I am looking for "([^"]*)" with the following params:$/ do |method, table|
  table.hashes.each do |attributes|
    @method = method.to_sym
    @attributes = attributes
  end
end

When /^I make request$/ do
  @options ||= {}
  @attributes ||= {}
  @response = @instance.send @method, *@attributes.values, @options
end

When /^I request "([^"]*)" page$/ do |link|
  @next_response = @response.send :"#{link}_page"
end

When /^I iterate through collection pages$/ do
  @pages = []
  @response.each_page do |page|
    @pages << page.flatten
  end
end

Then /^the response collection of resources is different for "([^"]*)" attribute$/ do |attr|
  @next_response.first.send(:"#{attr}").should_not eql @response.first.send(:"#{attr}")
end

Then /^this collection should include first page$/ do
  @pages.flatten.map(&:name).should include @response.first.name
end

Then /^request should fail with "([^"]*)"$/ do |exception|
  @options ||= {}
  @attributes ||= {}
  expect {
    @response = @instance.send @method, *@attributes.values, @options
  }.to raise_error(convert_to_constant(exception))
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
github_api-0.4.11 features/step_definitions/github_api_steps.rb
github_api-0.4.10 features/step_definitions/github_api_steps.rb
github_api-0.4.9 features/step_definitions/github_api_steps.rb
github_api-0.4.8 features/step_definitions/github_api_steps.rb
github_api-0.4.7 features/step_definitions/github_api_steps.rb
github_api-0.4.6 features/step_definitions/github_api_steps.rb
github_api-0.4.5 features/step_definitions/github_api_steps.rb
github_api-0.4.4 features/step_definitions/github_api_steps.rb
github_api-0.4.3 features/step_definitions/github_api_steps.rb