Sha256: 3e73d037326427ed4cc8baed15e516afca5b10e0b0c2696e106564ef80b51200

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

require 'hpricot'

require 'murlsh'

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

1 entries across 1 versions & 1 rubygems

Version Path
murlsh-1.1.0 spec/doc_spec.rb