Sha256: c75663d936857db7b04a6cbea2f03cd9a6fded25c3620d3f894b7c7f900aac87

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

require 'nokogiri'

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
      Nokogiri(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
      Nokogiri(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

4 entries across 4 versions & 1 rubygems

Version Path
murlsh-1.3.1 spec/doc_spec.rb
murlsh-1.3.0 spec/doc_spec.rb
murlsh-1.2.1 spec/doc_spec.rb
murlsh-1.2.0 spec/doc_spec.rb