Fixes for head tag regex #21

Merged
matthewlehner merged 2 commits from head_tag_only into master 2012-12-14 14:28:52 +00:00
Showing only changes of commit 0c5d9bc06b - Show all commits

View File

@ -223,5 +223,22 @@ describe Rack::LiveReload do
it { should be_bad_browser(user_agent) } it { should be_bad_browser(user_agent) }
end end
describe 'head tag regex' do
let(:regex) { described_class::HEAD_TAG_REGEX }
subject { regex }
it { should be_kind_of(Regexp) }
it 'only picks a valid <head> tag' do
regex.match("<head></head>").to_s.should eq('<head>')
regex.match("<head><title></title></head>").to_s.should eq('<head>')
regex.match("<head attribute='something'><title></title></head>").to_s.should eq("<head attribute='something'>")
end
it 'responds false when no head tag' do
regex.match("<header></header>").should be_false
end
end
end end