Sha256: a9c4e3add810473664abbf87e9c662721cea9d0ecef1dee45a61b9aa99c0adf6

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class BreadcrumbHelperHelperTest < ActionDispatch::IntegrationTest
  setup do
    Post.create!(subject: 'brabbel', body: 'Dies ist ein Test', user: 'wob', release: Date.today)
    Post.create!(subject: 'fasel', body: 'Dies ist ein zweiter Test', user: 'wob', release: Date.today)
  end

  test "show breadcrumbs in posts#index" do
    get home_path
    get posts_path
    assert_select "div#breadcrumbs" do
      assert_select "[href='/home?bci=0']", title: "Home"
      assert_select "[href='/posts?bci=1']", title: "Postings"
    end
  end

  test "show back_link from breadcrumbs after some actions" do
    get home_path
    get posts_path
    # as long as :back is not used, the test should succeed 
    get home_path, headers: {'HTTP_REFERER' => 'http://example.org'}
    get posts_path
    assert_select "[class=?]", "btn btn-secondary" do
      assert_select "[href='/home?bci=2']", text: /.*Zurück/
    end
  end

  test "show back_link :back" do
    get home_path, headers: {'HTTP_REFERER' => 'http://example.org'}
    assert_select "[class=?]", "btn btn-secondary" do
      assert_select "[href='http://example.org']"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wobapphelpers-3.1.1 test/breadcrumbs/breadcrumb_helper_test.rb
wobapphelpers-3.1.0 test/breadcrumbs/breadcrumb_helper_test.rb