rely directly on rack-mock
This commit is contained in:
parent
926ba0036c
commit
c06fbcfc93
5 changed files with 20 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
|||
# encoding: UTF-8
|
||||
|
||||
require 'rack/test'
|
||||
require 'rack/mock'
|
||||
|
||||
Given /^a clean server$/ do
|
||||
@initialize_commands = []
|
||||
|
@ -57,7 +57,7 @@ Given /^the Server is running$/ do
|
|||
end
|
||||
|
||||
app_rack = @server_inst.class.to_rack_app
|
||||
@browser = ::Rack::Test::Session.new(::Rack::MockSession.new(app_rack))
|
||||
@browser = ::Rack::MockRequest.new(app_rack)
|
||||
end
|
||||
|
||||
Given /^the Server is running at "([^\"]*)"$/ do |app_path|
|
||||
|
@ -66,33 +66,37 @@ Given /^the Server is running at "([^\"]*)"$/ do |app_path|
|
|||
end
|
||||
|
||||
When /^I go to "([^\"]*)"$/ do |url|
|
||||
@browser.get(URI.escape(url))
|
||||
@last_response = @browser.get(URI.escape(url))
|
||||
end
|
||||
|
||||
Then /^going to "([^\"]*)" should not raise an exception$/ do |url|
|
||||
lambda { @browser.get(URI.escape(url)) }.should_not raise_exception
|
||||
last_response = nil
|
||||
lambda {
|
||||
last_response = @browser.get(URI.escape(url))
|
||||
}.should_not raise_exception
|
||||
@last_response = last_response
|
||||
end
|
||||
|
||||
Then /^the content type should be "([^\"]*)"$/ do |expected|
|
||||
@browser.last_response.content_type.should start_with(expected)
|
||||
@last_response.content_type.should start_with(expected)
|
||||
end
|
||||
|
||||
Then /^I should see "([^\"]*)"$/ do |expected|
|
||||
@browser.last_response.body.should include(expected)
|
||||
@last_response.body.should include(expected)
|
||||
end
|
||||
|
||||
Then /^I should see '([^\']*)'$/ do |expected|
|
||||
@browser.last_response.body.should include(expected)
|
||||
@last_response.body.should include(expected)
|
||||
end
|
||||
|
||||
Then /^I should see:$/ do |expected|
|
||||
@browser.last_response.body.should include(expected)
|
||||
@last_response.body.should include(expected)
|
||||
end
|
||||
|
||||
Then /^I should not see "([^\"]*)"$/ do |expected|
|
||||
@browser.last_response.body.should_not include(expected)
|
||||
@last_response.body.should_not include(expected)
|
||||
end
|
||||
|
||||
Then /^I should see "([^\"]*)" lines$/ do |lines|
|
||||
@browser.last_response.body.chomp.split($/).length.should == lines.to_i
|
||||
@last_response.body.chomp.split($/).length.should == lines.to_i
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue