Sha256: 2d0fefb91f3f60b36bf4684d5e350d085d21d6ce8944a93fa68dde1890ce3280

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

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

2 entries across 2 versions & 1 rubygems

Version Path
meta-tags-1.2.6 spec/controller_helper_spec.rb
meta-tags-1.2.5 spec/controller_helper_spec.rb