Permalink
Browse files

== doesn't raise an exception for unrelated object

  • Loading branch information...
1 parent 6e67028 commit e1c9fb7c6c1c6f319b159dc4a83703a3b7cb97de @kou kou committed Nov 27, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −1 lib/capybara/node/matchers.rb
  2. +10 −0 spec/rspec/matchers_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
@@ -573,4 +573,14 @@
end.to raise_error(/expected to find table "No such Table"/)
end
end
+
+ describe "==" do
+ before do
+ visit('/with_html')
+ end
+
+ it "returns false for unrelated object" do
+ page.find("html").should_not == "Not Capybara::Node::Base"
+ end
+ end
end

0 comments on commit e1c9fb7

Please sign in to comment.