Sha256: c545cb6bd252e9604689208047e371574b95d3c4ccee408856edce7bd7212869

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

$:.unshift File.expand_path(File.dirname(__FILE__) + '/../app/helpers')
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'meta_tags_helper'

require 'rubygems'
require 'action_controller'
require 'action_view'
require 'action_view/test_case'

class RailsExtTest < ActionView::TestCase
  class MetaTagThingy
    attr_accessor :meta_author, :meta_geourl, :meta_copyright, :meta_keywords, :meta_description
    def initialize(*args)
      @meta_author, @meta_geourl, @meta_copyright, @meta_keywords, @meta_description = *args
    end
  end

  class MetaTagThingyController
    def current_resource
      MetaTagThingy.new("the author", "the geourl", "the copyright", "the keywords", "the description")
    end
  end

  tests MetaTagsHelper

  def setup
    super
    @controller = MetaTagThingyController.new
    @resource = MetaTagThingy.new("the author", "the geourl", "the copyright", "the keywords", "the description")
    @tags = meta_tags(@resource).split(/\n/)
  end

  test "returns meta tags as expected" do
    assert Array === @tags
    assert_equal 5, @tags.size
    assert_equal '<meta content="the author" name="author" />', @tags.first
  end

  test "#meta_value_from returns first non-blank value" do
    assert_equal 'foo', meta_value_from(nil, '', 'foo')
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
adva-0.1.4 test/meta_tags_test.rb
adva-0.1.3 test/meta_tags_test.rb
adva-0.1.2 test/meta_tags_test.rb
adva-0.1.1 test/meta_tags_test.rb
adva-0.1.0 test/meta_tags_test.rb
adva_meta_tags-0.0.1 test/meta_tags_test.rb
adva-0.0.1 adva_meta_tags/test/meta_tags_test.rb