diff --git a/lib/capybara/node/matchers.rb b/lib/capybara/node/matchers.rb
index 1e1c2503c..23fbff5e7 100644
--- a/lib/capybara/node/matchers.rb
+++ b/lib/capybara/node/matchers.rb
@@ -172,30 +172,6 @@ def has_no_css?(path, options={})
has_no_selector?(:css, path, options)
end
- ##
- #
- # Checks if the page or current node has the given text content,
- # ignoring any HTML tags and normalizing whitespace.
- #
- # @param [String] content The text to check for
- # @return [Boolean] Whether it exists
- #
- def has_content?(content)
- has_selector?(:content, normalize_whitespace(content))
- end
-
- ##
- #
- # Checks if the page or current node does not have the given text
- # content, ignoring any HTML tags and normalizing whitespace.
- #
- # @param [String] content The text to check for
- # @return [Boolean] Whether it exists
- #
- def has_no_content?(content)
- has_no_selector?(:content, normalize_whitespace(content))
- end
-
##
#
# Checks if the page or current node has the given text content,
@@ -217,6 +193,7 @@ def has_text?(content)
rescue Capybara::ExpectationNotMet
return false
end
+ alias_method :has_content?, :has_text?
##
#
@@ -239,6 +216,7 @@ def has_no_text?(content)
rescue Capybara::ExpectationNotMet
return false
end
+ alias_method :has_no_content?, :has_no_text?
##
#
diff --git a/lib/capybara/spec/session.rb b/lib/capybara/spec/session.rb
index bf9004d66..8f75455d5 100644
--- a/lib/capybara/spec/session.rb
+++ b/lib/capybara/spec/session.rb
@@ -97,7 +97,6 @@ def extract_results(session)
it_should_behave_like "find_link"
it_should_behave_like "find_by_id"
it_should_behave_like "find"
- it_should_behave_like "has_content"
it_should_behave_like "has_text"
it_should_behave_like "has_css"
it_should_behave_like "has_selector"
diff --git a/lib/capybara/spec/session/has_content_spec.rb b/lib/capybara/spec/session/has_content_spec.rb
deleted file mode 100644
index 7e99445f2..000000000
--- a/lib/capybara/spec/session/has_content_spec.rb
+++ /dev/null
@@ -1,139 +0,0 @@
-shared_examples_for "has_content" do
- describe '#has_content?' do
- it "should be true if the given content is on the page at least once" do
- @session.visit('/with_html')
- @session.should have_content('est')
- @session.should have_content('Lorem')
- @session.should have_content('Redirect')
- end
-
- it "should be true if scoped to an element which has the content" do
- @session.visit('/with_html')
- @session.within("//a[@title='awesome title']") do
- @session.should have_content('labore')
- end
- end
-
- it "should be false if scoped to an element which does not have the content" do
- @session.visit('/with_html')
- @session.within("//a[@title='awesome title']") do
- @session.should_not have_content('monkey')
- end
- end
-
- it "should ignore tags" do
- @session.visit('/with_html')
- @session.should_not have_content('exercitation ullamco laboris')
- @session.should have_content('exercitation ullamco laboris')
- end
-
- it "should ignore extra whitespace and newlines" do
- @session.visit('/with_html')
- @session.should have_content('text with whitespace')
- @session.should have_content(%|text with\n whitespace|)
- end
-
- it "should be false if the given content is not on the page" do
- @session.visit('/with_html')
- @session.should_not have_content('xxxxyzzz')
- @session.should_not have_content('monkey')
- end
-
- it 'should handle single quotes in the content' do
- @session.visit('/with-quotes')
- @session.should have_content("can't")
- end
-
- it 'should handle double quotes in the content' do
- @session.visit('/with-quotes')
- @session.should have_content(%q{"No," he said})
- end
-
- it 'should handle mixed single and double quotes in the content' do
- @session.visit('/with-quotes')
- @session.should have_content(%q{"you can't do that."})
- end
-
- it 'should be true if content is in the title tag in the head' do
- @session.visit('/with_js')
- @session.should have_content('with_js')
- end
-
- it 'should be true if content is inside a script tag in the body' do
- @session.visit('/with_js')
- @session.should have_content('a javascript comment')
- @session.should have_content('aVar')
- end
-
- it "should be true if the given content is on the page but not visible" do
- @session.visit('/with_html')
- @session.should have_content('Inside element with hidden ancestor')
- end
- end
-
- describe '#has_no_content?' do
- it "should be false if the given content is on the page at least once" do
- @session.visit('/with_html')
- @session.should_not have_no_content('est')
- @session.should_not have_no_content('Lorem')
- @session.should_not have_no_content('Redirect')
- end
-
- it "should be false if scoped to an element which has the content" do
- @session.visit('/with_html')
- @session.within("//a[@title='awesome title']") do
- @session.should_not have_no_content('labore')
- end
- end
-
- it "should be true if scoped to an element which does not have the content" do
- @session.visit('/with_html')
- @session.within("//a[@title='awesome title']") do
- @session.should have_no_content('monkey')
- end
- end
-
- it "should ignore tags" do
- @session.visit('/with_html')
- @session.should have_no_content('exercitation ullamco laboris')
- @session.should_not have_no_content('exercitation ullamco laboris')
- end
-
- it "should be true if the given content is not on the page" do
- @session.visit('/with_html')
- @session.should have_no_content('xxxxyzzz')
- @session.should have_no_content('monkey')
- end
-
- it 'should handle single quotes in the content' do
- @session.visit('/with-quotes')
- @session.should_not have_no_content("can't")
- end
-
- it 'should handle double quotes in the content' do
- @session.visit('/with-quotes')
- @session.should_not have_no_content(%q{"No," he said})
- end
-
- it 'should handle mixed single and double quotes in the content' do
- @session.visit('/with-quotes')
- @session.should_not have_no_content(%q{"you can't do that."})
- end
-
- it 'should be false if content is in the title tag in the head' do
- @session.visit('/with_js')
- @session.should_not have_no_content('with_js')
- end
-
- it 'should be false if content is inside a script tag in the body' do
- @session.visit('/with_js')
- @session.should_not have_no_content('a javascript comment')
- @session.should_not have_no_content('aVar')
- end
-
- it "should be false if the given content is on the page but not visible" do
- @session.visit('/with_html')
- @session.should_not have_no_content('Inside element with hidden ancestor')
- end
- end
-end