Sha256: 0a52812c57f790e425d2040ee128e8a1de92c81c89b0f5a8a6eb641c7f409bde

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

require 'test_helper'
require 'jquery-rails'
require 'shoulda-context'

class ActionViewHelperTest < 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

  context "without cancan" do
    should "show posts#index" do
      visit posts_path
      within('table tbody') do
	assert all(:xpath, '//a[contains(@class, "btn btn-secondary") and contains(@title, "Posting anzeigen")]').count == 2, 
	       "No show posting link found"
	assert all(:xpath, '//a[contains(@class,"btn btn-secondary") and contains(@title, "Posting bearbeiten")]').count == 2, 
	       "No edit posting link found"
	assert (all(:xpath, '//a[contains(@class,"btn btn-danger") and contains(@data-method, "delete") and contains(@title, "Posting löschen")]').length == 2), 
	       "No delete posting link found"
      end
      assert page.has_link?('Posting erstellen'), "no new post link found"
      assert find(:xpath, '//a[contains(@class, "btn btn-secondary") and contains(text(), "Posting erstellen")]'), 
	     "No new posting link found"
      assert page.has_link?('Zurück'), "No back button found"
      assert find(:xpath, '//a[contains(@class, "btn btn-secondary") and contains(text(), "Zurück")]'), 
	     "No back button found"
    end

    should "cancel_button renders i with class fas" do
      visit new_post_path
      assert page.has_text?('Posting erstellen')
      within('form') do
	assert page.has_link?('Abbrechen'), "button submit not found"
	assert find('a.btn.btn-secondary i.fas.fa-trash'), 
	       "button cancel not found"
     end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wobapphelpers-4.2.0 test/helpers/action_view_helper_test.rb
wobapphelpers-4.1.2 test/helpers/action_view_helper_test.rb
wobapphelpers-4.1.1 test/helpers/action_view_helper_test.rb
wobapphelpers-4.1.0 test/helpers/action_view_helper_test.rb
wobapphelpers-4.0.0 test/helpers/action_view_helper_test.rb