module Simulacrum::Methods

Rspec utility methods for defining components, browser environments

Public Instance Methods

component(name) { |options| ... } click to toggle source
# File lib/simulacrum/methods.rb, line 8
def component(name, &block)
  options = OpenStruct.new
  yield options
  component = Simulacrum::Component.new(name, options)
  Simulacrum.components[name] = component

  subject do
    component
  end

  let(:component) do
    component
  end
end
use_window_size(dimensions) click to toggle source
# File lib/simulacrum/methods.rb, line 23
def use_window_size(dimensions)
  subject do
    component.set_window_size(dimensions)
  end

  after(:each) do
    subject.reset_window_size
  end
end