Sha256: 5de217646d4802c278b5a13b7e4b0802c0b83ceb38e7a075157103e01383fd08

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

class MetaTagsController < ActionController::Base
  attr_reader :rendered

  def render_without_meta_tags
    @rendered = true
  end

  def index
    @page_title       = 'title'
    @page_keywords    = 'key1, key2, key3'
    @page_description = 'description'
    render
  end

  public :set_meta_tags, :meta_tags
end

describe MetaTags::ControllerHelper do
  subject { MetaTagsController.new }

  context 'module' do
    it 'should be mixed into ActionController::Base' do
      ActionController::Base.included_modules.should include(MetaTags::ControllerHelper)
    end

    it 'should respond to "set_meta_tags" helper' do
      subject.should respond_to(:set_meta_tags)
    end
  end

  describe '.render' do
    it 'should set meta tags from instance variables' do
      subject.index
      subject.rendered.should be_true
      subject.meta_tags.should == { 'title' => 'title', 'keywords' => 'key1, key2, key3', 'description' => 'description' }
    end
  end

  it_behaves_like '.set_meta_tags'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meta-tags-1.3.0 spec/controller_helper_spec.rb