Sha256: 25c1acc2e73043ca169845a6e5a26c33bfb5ed6b0a114bfa86071010f8375288

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe "Page class with face definitions" do
  class Page1
    include Watirloo::Page
  end
  
  it 'has face method as singleton' do
    Page1.singleton_methods.should include('face')
  end

  it 'face class method defines method' do
    Page1.face(:bla) do
      "hello"
    end
    page = Page1.new
    page.should respond_to(:bla)
    page.bla.should == 'hello'
  end

  it 'face accepts args used by method body' do
    Page1.face(:foo) do |x|
      x * 2
    end
    page = Page1.new
    page.foo(2).should == 4
    page.foo("bla").should == "blabla"
  end
end

describe "Page faces included in rspec" do

  include Watirloo::Page
  face(:last1) {doc.text_field(:name, 'last_name0')}
  face(:last) {|nbr| doc.text_field(:name, "last_name#{nbr+1}")}

  before do
    browser.goto testfile('census.html')
  end


  it 'face defines a watir element access' do
    last1.set "Zippididuda"
    last1.value.should == 'Zippididuda'
  end

  it 'faces with arguments' do
    last(1).set "Zorro"
    last(1).value.should == "Zorro"
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marekj-watirloo-0.0.5 spec/page_spec.rb