Sha256: e55a53ccf2610042157bb0b8199dd309ebe7c5b4913ee4f1b0b8a1ba619f754e

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 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

    it "can dish out the view" do
      screen.easy_view.should be(button_field)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mohawk-0.1.4 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.1.0 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.9 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.8 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.7 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.6 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.5 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.4 spec/lib/mohawk/accessors/button_spec.rb
mohawk-0.0.3 spec/lib/mohawk/accessors/button_spec.rb