Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: Manifest.txt README.txt
- Loading branch information
Showing
47 changed files
with
1,310 additions
and
214 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
coverage | ||
.DS_Store | ||
pkg | ||
doc | ||
ri | ||
email.txt | ||
email.txt |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
if RAILS_ENV == "test" | ||
if RAILS_ENV == "test" || RAILS_ENV == "selenium" | ||
require File.join(File.dirname(__FILE__), "lib", "webrat") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
module Webrat | ||
VERSION = '0.2.1' | ||
VERSION = '0.2.2' | ||
def self.root | ||
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root | ||
end | ||
end | ||
|
||
require "rubygems" | ||
require "active_support" | ||
|
||
require File.dirname(__FILE__) + "/webrat/core" | ||
require File.dirname(__FILE__) + "/webrat/rails" if defined?(RAILS_ENV) | ||
require File.dirname(__FILE__) + "/webrat/merb" if defined?(Merb) |
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,44 @@ | ||
module Webrat | ||
class Area | ||
|
||
def initialize(session, element) | ||
@session = session | ||
@element = element | ||
end | ||
|
||
def click(method = nil, options = {}) | ||
@session.request_page(absolute_href, :get, {}) | ||
end | ||
|
||
def matches_text?(id_or_title) | ||
matcher = /#{Regexp.escape(id_or_title.to_s)}/i | ||
title =~ matcher || id =~ matcher | ||
end | ||
|
||
protected | ||
|
||
def href | ||
@element["href"] | ||
end | ||
|
||
def title | ||
@element["title"] | ||
end | ||
|
||
def id | ||
@element["id"] | ||
end | ||
|
||
|
||
def absolute_href | ||
if href =~ /^\?/ | ||
"#{@session.current_url}#{href}" | ||
elsif href !~ %r{^https?://[\w|.]+(/.*)} && (href !~ /^\//) | ||
"#{@session.current_url}/#{href}" | ||
else | ||
href | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Webrat | ||
module Assertions | ||
|
||
def should_see(text_or_regexp) | ||
case text_or_regexp | ||
when Regexp | ||
return if scoped_html.match(text_or_regexp) | ||
else | ||
return if scoped_html.include?(text_or_regexp) | ||
end | ||
|
||
flunk("Should see #{text_or_regexp.inspect} but didn't") | ||
end | ||
|
||
def should_not_see(text_or_regexp) | ||
case text_or_regexp | ||
when Regexp | ||
return unless scoped_html.match(text_or_regexp) | ||
else | ||
return unless scoped_html.include?(text_or_regexp) | ||
end | ||
|
||
flunk("Should not see #{text_or_regexp.inspect} but did") | ||
end | ||
|
||
end | ||
end |
Oops, something went wrong.