Sha256: 337f9b5f277b772733b2847829955cd63c90bdb18ad347ab1d69ae6d91be295b

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

# frozen_string_literal: true

require 'test_helper'
class MountainViewStubTest < ActiveSupport::TestCase
  def test_meta_title
    test_object = stub_to_test

    assert_equal header_stub_meta[:stubs][0][:mv_stub_meta][:title],
                 test_object[0].meta_title('Header', 0),
                 'Stub Meta Title not found'
    assert_equal 'Header 2',
                 test_object[1].meta_title('Header', 1),
                 'Stub Meta Title default not set'
  end

  def test_meta_description
    test_object = stub_to_test
    assert_equal header_stub_meta[:stubs][0][:mv_stub_meta][:description],
                 test_object[0].meta_description,
                 'Stub Meta Description not found'
    assert_nil test_object[1].meta_description,
               'nil not set for stub meta without description'
  end

  def test_meta_classes
    test_object = stub_to_test
    assert_equal header_stub_meta[:stubs][0][:mv_stub_meta][:classes],
                 test_object[0].meta_classes,
                 'Stub Meta Classes not found'
    assert_nil test_object[1].meta_classes,
               'nil not set for stub meta without classes'
  end

  def test_properties
    test_object = stub_to_test
    assert_equal header_stub_meta[:stubs][0].except(:mv_stub_meta),
                 test_object[0].properties,
                 'Properties did not correctly return with stub meta data'
    assert_equal header_stub_meta[:stubs][1],
                 test_object[1].properties,
                 'Properties did not correctly return without stub meta data'
  end

  private

  def stub_to_test
    MountainView::Component.new('header').component_stubs
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mountain_view-0.14.0 test/mountain_view/stub_test.rb