Sha256: 61a91bc4433a6cfd8c4d966708f7327560e5dfd8d9317872d52a5dc194b37136

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

describe 'interacting with pages' do
  include_context :webapp

  let :page do
    Class.new do
      include PageMagic
      link(:next_page, text: 'next page')
      url '/page1'
    end.new
  end

  before(:each) { page.visit }

  describe 'visit' do
    it 'goes to the class define url' do
      page.visit
      page.session.current_path.should == '/page1'
    end
  end

  describe 'session' do
    it 'gives access to the page magic object wrapping the user session' do
      page.session.raw_session.should == Capybara.current_session
    end
  end

  describe 'text_on_page?' do
    it 'returns true if the text is present' do
      page.text_on_page?('next page').should be_true
    end

    it 'returns false if the text is not present' do
      page.text_on_page?('not on page').should be_false
    end
  end

  describe 'title' do
    it 'returns the title' do
      page.title.should == 'page1'
    end
  end

  describe 'text' do
    it 'returns the text on the page' do
      page.text.should == 'next page'
    end
  end

  describe 'method_missing' do
    it 'gives access to the elements defined on your page classes' do
      page.next_page.tag_name.should == 'a'
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
page_magic-1.0.0.alpha4 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-1.0.0.alpha3 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha8 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha7 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha6 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-1.0.0.alpha2 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-1.0.0.alpha spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha5 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha3 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha2 spec/page_magic/usage/interacting_with_pages_spec.rb
page_magic-0.11.0.alpha spec/page_magic/usage/interacting_with_pages_spec.rb