Skip to content

Instantly share code, notes, and snippets.

@turboladen
Created July 25, 2012 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboladen/3173856 to your computer and use it in GitHub Desktop.
Save turboladen/3173856 to your computer and use it in GitHub Desktop.
stuffer test
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