Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use CSS selectors in base url test

  • Loading branch information...
commit 1d412e2c8edc4a41da33291a1b9acff1643c69bf 1 parent 7520a02
@mocoso authored
Showing with 10 additions and 15 deletions.
  1. +2 −15 spec/cucumber_screenshot/world_spec.rb
  2. +8 −0 spec/spec_helper.rb
View
17 spec/cucumber_screenshot/world_spec.rb
@@ -99,7 +99,7 @@ class TestWorld
@session.stub!(:base_url => 'http://localhost:3000')
end
- it 'should insert base url into head element when there is a base url' do
+ it 'should insert base url into head element when there is a base url has been configures' do
source = %{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
@@ -112,20 +112,7 @@ class TestWorld
</body>
</html>
}
-
- output = %{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://www.w3.org/2005/10/profile">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<base href="http://localhost:3000">
-<link href="/stylesheets/foo.css" media="screen" rel="stylesheet" type="text/css">
-</head>
-<body>
-<h1>A title</h1>
-</body>
-</html>
-}
- @session.send(:rewrite_local_urls, source).should == output
+ @session.send(:rewrite_local_urls, source).should have_selector(%{head > base[href="http://localhost:3000"]})
end
it 'should not change the document when there is no head element' do
View
8 spec/spec_helper.rb
@@ -1,2 +1,10 @@
require 'rubygems'
require 'cucumber_screenshot'
+
+require "nokogiri"
+require "webrat/core/matchers"
+
+Spec::Runner.configure do |config|
+ config.include(Webrat::Matchers)
+end
+

0 comments on commit 1d412e2

Please sign in to comment.
Something went wrong with that request. Please try again.