Permalink
Browse files

Merge pull request #888 from kou/equal-not-raise

== doesn't raise an exception for unrelated object
  • Loading branch information...
2 parents c65a61c + 00529d2 commit 86e86c24b794bfd66f679b3cd2e052859ecb3402 @jnicklas jnicklas committed Nov 30, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/capybara/node/matchers.rb
  2. +4 −0 lib/capybara/spec/session/node_spec.rb
@@ -451,7 +451,7 @@ def has_no_table?(locator, options={})
end
def ==(other)
- self.eql?(other) or base == other.base
+ self.eql?(other) or (other.respond_to?(:base) and base == other.base)
end
private
@@ -114,6 +114,10 @@
(@session.find('//h1') === @session.find('//h1')).should be_true
(@session.find('//h1').eql? @session.find('//h1')).should be_false
end
+
+ it "returns false for unrelated object" do
+ (@session.find('//h1') == "Not Capybara::Node::Base").should be_false
+ end
end
describe "#trigger", :requires => [:js, :trigger] do

0 comments on commit 86e86c2

Please sign in to comment.