Sha256: 0ec855f6ef9878544650e22d70985841c2d34163c62dfab99f14114eb1224335

Contents?: true

Size: 974 Bytes

Versions: 2

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class BuoysBuoyTest < ActiveSupport::TestCase
  setup do
    @view_context = ActionView::Base.new
    Buoys::Loader.load_buoys_files
  end

  test 'can interpret multiple `link`s in one buoy block with argument' do
    links = Buoys::Buoy.new(@view_context, :help, true).links

    assert_equal links.size, 2
    assert_equal links[0].text, 'help'
    assert_equal links[0].url,  'https://example.com/help'
    assert_equal links[1].text, 'usage'
    assert_equal links[1].url,  'https://example.com/help/usage'

    links = Buoys::Buoy.new(@view_context, :help, false).links

    assert_equal links[0].url,  'http://example.com/help'
    assert_equal links[1].url,  'http://example.com/help/usage'
  end

  test 'can use :symbol as link name' do
    links = Buoys::Buoy.new(@view_context, :account).links

    assert_equal links[0].text, 'Account'
    assert_equal links[0].url,  'http://example.com/account'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buoys-1.1.0 test/buoys_buoy_test.rb
buoys-1.0.0 test/buoys_buoy_test.rb