Created
July 25, 2012 01:31
-
-
Save turboladen/3173856 to your computer and use it in GitHub Desktop.
stuffer test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given /^a set of test results from Tim$/ do | |
@suite_result = { | |
component_name: 'stuffer', | |
suite_name: 'Stuffer Acceptance', | |
build_version: Stuffer::VERSION, | |
results: [ | |
{ | |
'Stuffer Acceptance Test Feature' => { | |
'Stuffer Acceptance Test #1' => { | |
'Step 1' => :passed, | |
'Step 2' => :failed, | |
} | |
} | |
}, | |
{ | |
'Stuffer Acceptance Test Feature' => { | |
'Stuffer Acceptance Test #2' => { | |
'Step 1' => :passed, | |
'Step 2' => :failed, | |
} | |
} | |
}, | |
] | |
} | |
end | |
Given /^that the "(.*?)" user exists on (.+)$/ do |username, server_name| | |
@turducken_server = "http://#{server_name}" | |
@username = username | |
@password = 'stuffer_tester' | |
html_request = { | |
username: @username, | |
password: @password, | |
confirm_password: @password | |
} | |
response = HTTParty.post("#{@turducken_server}/accounts/create", | |
{ body: html_request }) | |
response.code.should be 200 | |
end | |
When /^I log in to (.+)$/ do |server_name| | |
@turducken_server = "http://#{server_name}" | |
session_info = Stuffer.login(turducken_server, username, password) | |
session_info.should match /^rack\.session=/ | |
end | |
When /^I stuff .+$/ do | |
@suite_result_url = Stuffer.stuff(@suite_result) | |
end | |
Then /^I get a URL to the location of the new suite result$/ do | |
@suite_result_url.should match /#{turducken_server}\/suite_results\/.+/ | |
end | |
Then /^I should see all test results as part of 1 suite result$/ do | |
response = HTTParty.get(@suite_result_url, { | |
headers: { 'Accept' => 'application/json' } | |
}) | |
suite_result = JSON.parse(response.body, symbolize_names: true) | |
suite_result[:suite_result][:test_results].size.should == @suite_result[:results].size | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment