Sha256: c5b3abdd858c040d637833c6bb499e7940e41584bb5f929e4a14ecc9dedaa732

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe TopHat::RobotsHelper do

  before(:all) do
    @template = ActionView::Base.new
  end

  describe ".nofollow" do
    it "should default to all robots" do
      @template.nofollow.should == "<meta content=\"nofollow\" name=\"robots\" />"
    end

    it "should use a descriptor if one is provided" do
      @template.nofollow('googlebot').should == "<meta content=\"nofollow\" name=\"googlebot\" />"
    end
  end

  describe ".noindex" do
    it "should default to all robots" do
      @template.noindex.should == "<meta content=\"noindex\" name=\"robots\" />"
    end

    it "should use a descriptor if one is provided" do
      @template.noindex('googlebot').should == "<meta content=\"noindex\" name=\"googlebot\" />"
    end
  end

  describe ".canonical" do
    it "should not render when not passed a path" do
      @template.canonical.should be_nil
    end

    it "should render a tag when passed a path" do
      @template.canonical('http://mysite.com/somepath/').should == "<link href=\"http://mysite.com/somepath/\" rel=\"canonical\" />"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tophat-1.4.0 spec/tophat/robots_helper_spec.rb
tophat-1.3.1 spec/tophat/robots_helper_spec.rb
tophat-1.3.0 spec/tophat/robots_helper_spec.rb