Sha256: 5dd07465a3cfb4c4450273aa4c949a69ae4a91313edbb7303a095cc0c16c845f

Contents?: true

Size: 943 Bytes

Versions: 6

Compression:

Stored size: 943 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
buoys-0.6.0 test/buoys_buoy_test.rb
buoys-0.5.0 test/buoys_buoy_test.rb
buoys-0.4.0 test/buoys_buoy_test.rb
buoys-0.3.0 test/buoys_buoy_test.rb
buoys-0.2.0 test/buoys_buoy_test.rb
buoys-0.1.0 test/buoys_buoy_test.rb