Sha256: e6c4ca4f69cce390699901ffba394f74cda12fec6dd06c7a092e54dd0e4d732e

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

%w{
hpricot

murlsh
}.each { |m| require m }

describe Murlsh::Doc do

  context 'when html has everything' do
    subject do
      html = <<eos
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="description" content="the description" />
    <title>the title</title>
  </head>
<body>
  <h1>hi</h1>
</body>
</html>
eos
      Hpricot(html).extend(Murlsh::Doc)
    end

    its(:charset) { should == 'utf-8' }
    its(:title) { should == 'the title' }
    its(:description) { should == 'the description' }
  end

  context 'when html has nothing' do
    subject do
      html = <<eos
<html>
  <head>
  </head>
<body>
  <h1>hi</h1>
</body>
</html>
eos
      Hpricot(html).extend(Murlsh::Doc)
    end

    its(:charset) { should be_nil }
    its(:title) { should be_nil }
    its(:description) { should be_nil }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
murlsh-0.9.0 spec/doc_spec.rb
murlsh-0.8.1 spec/doc_spec.rb
murlsh-0.8.0 spec/doc_spec.rb