Sha256: ad6cd4893b3446f1bc42de9d0a1db6144a7e1391bbee565c60fdddcf06c1856b

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

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

  checkbox(:check_yourself, :id => "checkboxId")
end

describe Mohawk::Accessors::CheckBox do
  let(:screen) { CheckboxScreen.new }
  let(:window) { double("RAutomation Window") }
  let(:checkbox_field) { double("CheckBox Field") }

  before(:each) do
    RAutomation::Window.stub(:new).and_return(window)
    window.should_receive(:checkbox).with(:id => "checkboxId").and_return(checkbox_field)
  end

  context "accessing checkbox controls" do

    it "knows if something is checked" do
      checkbox_field.should_receive(:set?).and_return(true)
      screen.check_yourself.should be_true
    end

    it "can get the text of the checkbox" do
      checkbox_field.should_receive(:value).and_return("CheckBox Text")
      screen.check_yourself_value.should eq("CheckBox Text")
    end

    it "can check items" do
      checkbox_field.should_receive(:set)
      screen.check_yourself = true
    end

    it "can uncheck items" do
      checkbox_field.should_receive(:clear)
      screen.check_yourself = false
    end
     
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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