Sha256: bd77fe94c2b8da6e43683f79f15dc544e837efca0861c1ed7ee25cd992b52636

Contents?: true

Size: 543 Bytes

Versions: 10

Compression:

Stored size: 543 Bytes

Contents

module Waterpig
  module BrowserSize
    def self.included(group)
      group.before(:each) do |example|
        sizes = RSpec.configuration.waterpig_browser_sizes
        BrowserSize.resize_browser_window(sizes[BrowserSize.current_size(example)])
      end
    end

    def self.resize_browser_window(size)
      Capybara.current_session.driver.browser.manage.window.resize_to(size[:width], size[:height])
    end

    def self.current_size(example)
      (example.metadata[:size] || ENV['BROWSER_SIZE'] || :desktop).to_sym
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
waterpig-0.9.2 lib/waterpig/browser-size.rb
waterpig-0.9.1 lib/waterpig/browser-size.rb
waterpig-0.9.0 lib/waterpig/browser-size.rb
waterpig-0.8.1 lib/waterpig/browser-size.rb
waterpig-0.8.0 lib/waterpig/browser-size.rb
waterpig-0.7.0 lib/waterpig/browser-size.rb
waterpig-0.6.1 lib/waterpig/browser-size.rb
waterpig-0.6.0 lib/waterpig/browser-size.rb
waterpig-0.5.0 lib/waterpig/browser-size.rb
waterpig-0.4.0 lib/waterpig/browser-size.rb