Sha256: da87ea3fa8ef294ad2a8bd82971919c378241472661c2038b2e17f493d1f1a89

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

class ButtonScreen
  include Mohawk
  window(:id => nil)

  button(:easy, :id => "easyButton")
end

describe Mohawk::Accessors::Button do
  let(:screen) { ButtonScreen.new }
  let(:window) { double("RAutomation Window") }
  let(:button_field) { double("Button Field") }

  before(:each) do
    RAutomation::Window.stub(:new).and_return(window)
    window.should_receive(:button).with(:id => "easyButton").and_return(button_field)
  end

  context "accessing buttons" do

    it "clicks buttons" do
      button_field.should_receive(:click).and_yield
      screen.easy
    end

    it "clicks buttons and yields to a block" do
      button_field.should_receive(:click).and_yield
      result = false
      screen.easy do
        result = true
      end
      result.should be_true
    end

    it "knows the value of the button" do
      button_field.should_receive(:value).and_return "Button Value"
      screen.easy_value.should eq("Button Value")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mohawk-0.0.2 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.1 spec/lib/mohawk/accessors/button_spec.rb