-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yunlei
committed
Sep 23, 2014
1 parent
0ed0c32
commit 1622249
Showing
16 changed files
with
157 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# encoding: UTF-8 | ||
This comment has been minimized.
Sorry, something went wrong. |
||
# This file is auto-generated from the current state of the database. Instead | ||
# of editing this file, please use the migrations feature of Active Record to | ||
# incrementally modify your database, and then regenerate this schema definition. | ||
# | ||
# Note that this schema.rb definition is the authoritative source for your | ||
# database schema. If you need to create the application database on another | ||
# system, you should be using db:schema:load, not running all the migrations | ||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
# you'll amass, the slower it'll run and the greater likelihood for issues). | ||
# | ||
# It's strongly recommended to check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(:version => 1) do | ||
|
||
create_table "authors", :force => true do |t| | ||
t.integer "lock_version" | ||
t.string "first_name" | ||
t.string "last_name" | ||
t.datetime "created_at", :null => false | ||
t.datetime "updated_at", :null => false | ||
end | ||
|
||
create_table "books", :force => true do |t| | ||
t.integer "lock_version" | ||
t.integer "author_id" | ||
t.string "title" | ||
t.datetime "created_at", :null => false | ||
t.datetime "updated_at", :null => false | ||
end | ||
|
||
create_table "indices", :force => true do |t| | ||
t.integer "lock_version" | ||
t.integer "pages" | ||
t.integer "book_id" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,46 @@ | ||
require 'unit_helper' | ||
|
||
module AePageObjects | ||
This comment has been minimized.
Sorry, something went wrong.
dtognazzini
Contributor
|
||
class DocumentQueryTest < Test::Unit::TestCase | ||
|
||
|
||
def test_default_document_class | ||
hello_class = ::AePageObjects::Document.new_subclass | ||
kitty_class = ::AePageObjects::Document.new_subclass | ||
|
||
|
||
This comment has been minimized.
Sorry, something went wrong. |
||
document_query = DocumentQuery.new do |query| | ||
query.matches(hello_class) | ||
query.matches(kitty_class) | ||
end | ||
|
||
assert_equal hello_class, document_query.default_document_class | ||
end | ||
|
||
def test_permitted_types_dump | ||
|
||
This comment has been minimized.
Sorry, something went wrong. |
||
hello_class = ::AePageObjects::Document.new_subclass do | ||
def self.name | ||
"hello" | ||
end | ||
end | ||
|
||
kitty_class = ::AePageObjects::Document.new_subclass do | ||
def self.name | ||
"kitty" | ||
end | ||
end | ||
|
||
document_query = DocumentQuery.new do |query| | ||
query.matches(hello_class) | ||
query.matches(kitty_class) | ||
end | ||
|
||
assert_equal ["hello", "kitty"].inspect, document_query.permitted_types_dump | ||
|
||
# it's memoized | ||
#assert_equal ["AePageObjects::DocumentLoaderTest::DocumentClass1", "AePageObjects::DocumentLoaderTest::DocumentClass2"].inspect, loader.permitted_types_dump | ||
This comment has been minimized.
Sorry, something went wrong. |
||
end | ||
|
||
def test_query_conditions | ||
block_condition = proc do |page| | ||
page.is_starbucks? | ||
|
@@ -97,4 +135,4 @@ def setup_page_for_conditions(options = {}) | |
stub(:current_url => options[:current_url], :is_starbucks? => options[:is_starbucks?]) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,18 +119,18 @@ def test_document_not_loaded_error | |
) | ||
|
||
loader = CrossWindowLoaderStrategy.new(window_list) | ||
page_loader = mock(:permitted_types_dump => "permitted_types_dump") | ||
query = mock(:permitted_types_dump => "permitted_types_dump") | ||
|
||
error = loader.document_not_loaded_error(page_loader) | ||
error = loader.document_not_loaded_error_message(query) | ||
This comment has been minimized.
Sorry, something went wrong.
dtognazzini
Contributor
|
||
|
||
all_windows_dump = [ | ||
{:window_handle => "window1", :document => "Document1"}, | ||
{:window_handle => "window2", :document => "<none>"}, | ||
{:window_handle => "window3", :document => "Document3"}, | ||
] | ||
|
||
assert_equal "Couldn't find document with type in permitted_types_dump in any of the open windows: #{all_windows_dump.inspect}", error.message | ||
assert_equal "Couldn't find document with type in permitted_types_dump in any of the open windows: #{all_windows_dump.inspect}", error | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.
Please remove extra space before super