Sha256: e9fd32adc377d9d3ff6e915a0097dc8eaccf943bb394d70e5d80894fa9037da3

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

require_relative '../spec_helper'

describe 'WebElements::SelectList' do
  let(:select_list_object) { double('select_list_object') }
  let(:select_list_definition) { ::Fluent::WebElements::SelectList.new(select_list_object, :platform => :watir_webdriver) }
  let(:select_list_options) { [select_list_object, select_list_object] }
  
  # select_list_actual == select_list_definition
  
  it 'should determine if an option is selected' do
    select_list_object.stub(:selected?).with('testing').and_return(true)
    select_list_definition.selected?('testing')
  end

  it 'should be able to select an item by option' do
    select_list_object.should_receive(:select).and_return(true)
    select_list_definition.select('testing')
  end

  it 'should be able to select an item by value' do
    select_list_object.should_receive(:select_value).and_return(true)
    select_list_definition.select_value('testing')
  end

  it 'should return an array of selected options' do
    select_list_object.stub(:selected_options).and_return(select_list_options)
    select_list_object.stub(:text).and_return(select_list_object)
    select_list_definition.selected_options.should == select_list_options
  end

  it 'should get the values for any selected options' do
    select_list_object.stub(:selected_options).and_return(select_list_options)
    select_list_object.stub(:value).and_return(select_list_object)
    select_list_definition.selected_values.should == select_list_options
  end

  it 'should determine if an option is available in the list' do
    select_list_object.stub(:include?).with('testing').and_return(true)
    select_list_definition.include?('testing')
  end

  it 'should register with a select list tag' do
    ::Fluent::WebElements.get_class_for(:select).should == ::Fluent::WebElements::SelectList
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-0.4.0 spec/web_elements/select_list_spec.rb
fluent-0.3.0 spec/web_elements/select_list_spec.rb