Sha256: beb4a5f2f0508809e4767a4ad05de4df0d517f5dfb6d596fa974f8d2f66b70de

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true
require 'test_helper'

class ActionViewHelpersTest < ActionDispatch::IntegrationTest
  setup do
    aamine = Author.create! name: 'aamine'
    @rhg = aamine.books.create! title: 'RHG'
    @rhg_novel = aamine.books.create! title: 'RHG Novel', type: 'Novel'
  end

  test 'invoking action_view helper methods' do
    visit "/authors/#{@rhg.author.id}/books/#{@rhg.id}"
    within 'a.title' do
      assert page.has_content? 'RHG'
    end
    assert page.has_css?('img')
  end

  test 'invoking action_view helper methods on model subclass' do
    visit "/authors/#{@rhg_novel.author.id}/books/#{@rhg_novel.id}"
    within 'a.title' do
      assert page.has_content? 'RHG Novel'
    end
    assert page.has_css?('img')
  end

  test 'invoking action_view helper methods in rescue_from view' do
    visit "/authors/#{@rhg.author.id}/books/#{@rhg.id}/error"
    assert page.has_content?('ERROR')
  end

  test 'make sure that action_view + action_mailer works' do
    visit "/authors/#{@rhg.author.id}/books/#{@rhg.id}"
    click_link 'purchase'
    assert page.has_content? 'done'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_decorator-1.0.0 test/features/action_view_helpers_test.rb
active_decorator-0.9.0 test/features/action_view_helpers_test.rb
active_decorator-0.8.0 test/features/action_view_helpers_test.rb