Skip to content

Instantly share code, notes, and snippets.

@rahul100885
Created October 13, 2013 18:48
Show Gist options
  • Save rahul100885/6965853 to your computer and use it in GitHub Desktop.
Save rahul100885/6965853 to your computer and use it in GitHub Desktop.
Set browser screen size in rspec + capybara suite for responsive web design test.
# spec/support/device_size.rb
module DeviceSize
extend ScreenSize
RSpec.configure do |config|
config.before(:each) do
if example.metadata[:device_size].blank?
# set screen size default to :large
DeviceSize.set_screen_size DeviceSize.default_size
else
DeviceSize.set_screen_size example.metadata[:devise_size]
end
end
# include screen size into feature spec
config.include ScreenSize, :type => :feature
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment