Sha256: dc540a0b96fcf21e891130f0d3ab73064e4179ea3179d93e4cd9b1fb88697c42

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require "test_helper"

class MountainViewComponentTest < ActiveSupport::TestCase
  def test_name
    component = MountainView::Component.new("header")

    assert_equal "header", component.name
  end

  def test_humanized_title
    component = MountainView::Component.new("social_media_icons")

    assert_equal "Social media icons", component.title
  end

  def test_styleguide_stubs
    component = MountainView::Component.new("header")

    expected_stub = {
      id: 1,
      title: "20 Mountains you didn't know they even existed",
      subtitle: "Buzzfeed title"
    }

    assert_instance_of Array, component.styleguide_stubs
    assert_equal expected_stub, component.styleguide_stubs.first
  end

  def test_stubs_file
    component = MountainView::Component.new("header")

    expected_stubs_file = Rails.root.join("app/components/header/header.yml")
    assert_equal expected_stubs_file, component.stubs_file
  end

  def test_stubs?
    component_with_stubs = MountainView::Component.new("header")
    component_without_stub_file = MountainView::Component.new("social_media_icons")
    component_with_empty_stub_file = MountainView::Component.new("breadcrumbs")

    assert_equal true, component_with_stubs.stubs?
    assert_equal false, component_without_stub_file.stubs?
    assert_equal false, component_with_empty_stub_file.stubs?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mountain_view-0.7.1 test/mountain_view/component_test.rb
mountain_view-0.7.0 test/mountain_view/component_test.rb