Sha256: c493ace63e8edebc9a8feefa48bb080546a5f540e767020932dffe0b955e3ce4

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

class LinkHelperTest < EaselHelpers::ViewTestCase
  context "link_button" do

    should "default with the correct structure" do
      show_view "<%= link_button 'Link Text', '#' %>" do
        assert_select "a.btn[href=#]" do
          assert_select "span", "Link Text"
        end
      end
    end

    should "allow the same assignment as link_to" do
      show_view "<%= link_button 'Link Text', '#', :class => 'my-button', :id => 'link-text' %>" do
        assert_select "a.btn.my-button#link-text[href=#]" do
          assert_select "span", "Link Text"
        end
      end
    end

  end

  context "link_to_email" do
    should "default with the correct structure" do
      show_view "<%= link_to_email 'test@example.com' %>" do
        assert_select "a[href=mailto:test@example.com]", "test@example.com"
      end
    end

    should "allow override of link text as the first argument after email" do
      show_view "<%= link_to_email 'test@example.com', 'Send an email to Test User' %>" do
        assert_select "a[href=mailto:test@example.com]", "Send an email to Test User"
      end
    end

    should "allow the same assignment as link_to" do
      show_view "<%= link_to_email 'test@example.com', :class => 'test-user-email', :id => 'user_1_email' %>" do
        assert_select "a.test-user-email#user_1_email[href=mailto:test@example.com]", "test@example.com"
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
fusionary-easel_helpers-0.2.17 test/link_helper_test.rb
fusionary-easel_helpers-0.3.0 test/link_helper_test.rb
easel_helpers-0.3.0 test/link_helper_test.rb