Sha256: bf09e468756c228f7d7531caaac6a70a527c217fbd64f3dc4689a9760cfe04d4

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

require 'spec_helper'

describe Furter::Accessors::Switch do
  let(:switch) { Furter::Accessors::Switch.new(:label => 'accessibilityLabel') }

  context 'locating switches' do
    it 'can be found by label' do
      switch.send(:selector).should eq("view:'UISwitch' marked:'accessibilityLabel'")
    end
  end

  it 'knows if it is on' do
    switch.should_receive(:frankly_map).with(anything, 'isOn').and_return([false])
    switch.should_not be_on
  end

  it 'can turn it off or on' do
    switch.should_receive(:on?).and_return(true, false)
    switch.should_receive(:click).twice
    [false, true].each { |on_or_off| switch.set on_or_off }
  end

  it 'will only toggle if in the expected state' do
    switch.should_receive(:frankly_map).with(anything, 'isOn').and_return([false])
    switch.should_not_receive(:click)
    switch.set false
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
furter-0.0.3.2 spec/lib/furter/accessors/switch_spec.rb
furter-0.0.3.1 spec/lib/furter/accessors/switch_spec.rb
furter-0.0.3 spec/lib/furter/accessors/switch_spec.rb