Sha256: 7db834330ccecfd9b3166b523665db16d3f5a774f2a2b3b0ddc2569c4793e819

Contents?: true

Size: 932 Bytes

Versions: 2

Compression:

Stored size: 932 Bytes

Contents

require 'spec_helper'

class Item
  def keywords
    'item,item_keywords'
  end
end

describe 'render_keywords' do
  before do
    Rails.application.secrets[:keywords] = 'keywords'
  end

  it 'simple' do
    expect(render_keywords).to eq('<meta name="keywords" content="keywords" />')
  end

  it '@keywords' do
    @keywords = '@keywords'
    expect(render_keywords).to eq('<meta name="keywords" content="@keywords" />')
    @keywords = ['@keywords', '   ', '', nil]
    expect(render_keywords).to eq('<meta name="keywords" content="@keywords" />')
    ['   ', '', nil].each do |key|
      @keywords = key
      expect(render_keywords).to eq('')
    end
  end

  it '@item' do
    @item = Item.new
    expect(render_keywords).to eq('<meta name="keywords" content="item,item_keywords" />')
  end

  it 'opts' do
    expect(render_keywords(keywords: 'opts,a,b,c')).to eq('<meta name="keywords" content="opts,a,b,c" />')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
h2ocube_rails_helper-0.2.1 spec/helpers/render_keywords_spec.rb
h2ocube_rails_helper-0.2.0 spec/helpers/render_keywords_spec.rb