2009-11-22 18:37:11 -05:00
|
|
|
Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
|
2011-07-24 01:49:32 -04:00
|
|
|
@server ||= Middleman.server
|
2011-09-09 02:06:22 -04:00
|
|
|
@server.set :show_exceptions, false
|
2011-07-24 01:49:32 -04:00
|
|
|
if state == "enabled"
|
|
|
|
@server.activate(feature.to_sym)
|
2010-09-06 21:48:25 -04:00
|
|
|
end
|
2011-07-24 01:49:32 -04:00
|
|
|
@server.set :environment, @current_env || :development
|
|
|
|
end
|
|
|
|
|
|
|
|
Given /^"([^\"]*)" is set to "([^\"]*)"$/ do |variable, value|
|
|
|
|
@server ||= Middleman.server
|
2011-09-09 02:06:22 -04:00
|
|
|
@server.set :show_exceptions, false
|
2011-07-24 01:49:32 -04:00
|
|
|
@server.set variable.to_sym, value
|
2009-11-22 18:37:11 -05:00
|
|
|
end
|
|
|
|
|
2011-05-29 11:26:58 -04:00
|
|
|
Given /^current environment is "([^\"]*)"$/ do |env|
|
|
|
|
@current_env = env.to_sym
|
|
|
|
end
|
|
|
|
|
2011-07-27 22:59:38 -04:00
|
|
|
Given /^the Server is running at "([^\"]*)"$/ do |app_path|
|
2011-07-24 01:49:32 -04:00
|
|
|
@server ||= Middleman.server
|
2011-09-09 02:06:22 -04:00
|
|
|
@server.set :show_exceptions, false
|
2011-07-27 22:59:38 -04:00
|
|
|
root = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
|
|
@server.set :root, File.join(root, "fixtures", app_path)
|
2011-07-24 01:49:32 -04:00
|
|
|
@browser = Rack::Test::Session.new(Rack::MockSession.new(@server.new))
|
2009-11-30 14:32:02 -05:00
|
|
|
end
|
|
|
|
|
2009-11-22 18:37:11 -05:00
|
|
|
When /^I go to "([^\"]*)"$/ do |url|
|
|
|
|
@browser.get(url)
|
|
|
|
end
|
|
|
|
|
|
|
|
Then /^I should see "([^\"]*)"$/ do |expected|
|
|
|
|
@browser.last_response.body.should include(expected)
|
|
|
|
end
|
2011-04-25 16:45:54 -04:00
|
|
|
|
2010-09-06 13:59:51 -04:00
|
|
|
Then /^I should see '([^\']*)'$/ do |expected|
|
|
|
|
@browser.last_response.body.should include(expected)
|
|
|
|
end
|
2009-11-22 18:37:11 -05:00
|
|
|
|
|
|
|
Then /^I should not see "([^\"]*)"$/ do |expected|
|
|
|
|
@browser.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
|
|
|
|
end
|