Sha256: ec942e272f0a54a2c962746a44da2cf597e82c90e1182a3a2a112964635110bd

Contents?: true

Size: 568 Bytes

Versions: 6

Compression:

Stored size: 568 Bytes

Contents

require "capybara"
require "testable/capybara/node"

module Testable
  class Page < Node
    # The `Page` class wraps an HTML page with an application-specific API.
    # This can be extended to define an API for manipulating the pages of
    # the web application.
    attr_reader :path

    def self.visit
      new.visit
    end

    def initialize(node: Capybara.current_session, path: nil)
      @node = node
      @path = path
    end

    def visit
      @node.visit(path)
      self
    end

    def current?
      @node.current_path == path
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
testable-0.10.0 lib/testable/capybara/page.rb
testable-0.9.0 lib/testable/capybara/page.rb
testable-0.8.0 lib/testable/capybara/page.rb
testable-0.7.0 lib/testable/capybara/page.rb
testable-0.6.0 lib/testable/capybara/page.rb
testable-0.5.0 lib/testable/capybara/page.rb