Sha256: e205743d9cbaeb32983d11fbe7bfc9e05e8e9a916d20253cada99b6553f83006

Contents?: true

Size: 666 Bytes

Versions: 3

Compression:

Stored size: 666 Bytes

Contents

# encoding: UTF-8
require 'ostruct'
require_relative './component'

module Simulacrum
  # Rspec utility methods for defining components, browser environments
  module Methods
    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

    def use_window_size(dimensions)
      subject do
        component.set_window_size(dimensions)
      end

      after(:each) do
        subject.reset_window_size
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simulacrum-0.3.2 lib/simulacrum/methods.rb
simulacrum-0.3.1 lib/simulacrum/methods.rb
simulacrum-0.3.0 lib/simulacrum/methods.rb