Sha256: 73222cf371a8b01b3d9af9c0cb2c46685c6459ac5948f5f5d01acc417e797871
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
Before do Kajam::Cache.use_x_sendfile = false Kajam::Cache.use_x_accel_redirect = nil end Given /^the page cache is clear$/ do # No-op until we have Rack::Cache installed Kajam::Cache.clear if defined?(Kajam::Cache) end Then /^I should get a (\d+) response code$/ do |code| response.response_code.should == code.to_i end Given /^I have turned on X\-Sendfile headers$/ do Kajam::Cache.use_x_sendfile = true end Then /^I should( not)? get an "([^\"]*)" header in the response$/ do |status, header_key| if status.nil? response.headers.to_hash[header_key].should_not be_empty else response.headers.to_hash[header_key].should be_empty end end Given /^I have turned on X\-Accel\-Redirect headers$/ do Kajam::Cache.use_x_accel_redirect = "/cache" end Given /^I have page caching (on|off)$/ do |status| set_page_cache status end Then /^the "([^\"]*)" header should be "([^\"]*)"$/ do |header_key, value| response.headers.to_hash[header_key].should =~ Regexp.new(value) end Then /^the page should render$/ do |text| if defined?(Spec::Rails::Matchers) response.body.should include(text) else assert_contain text end end Then /^the page should not render$/ do |text| if defined?(Spec::Rails::Matchers) response.body.should_not include(text) else assert_not_contain text end end def set_page_cache(status) Page.class_eval %{ def cache? #{status != 'off'} end }, __FILE__, __LINE__ end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kajam-1.0.3.rc2 | features/step_definitions/page_serving_steps.rb |