require 'test_helper'
class HelperTest < ActionView::TestCase
test 'link_to_new' do
assert_equal "New User",
link_to_new(User)
end
test 'link_to_edit' do
assert_equal "Edit User", link_to_edit(@user)
end
test 'link_to_destroy' do
assert_equal "Delete User",
link_to_destroy(@user)
end
test 'link_to_destroy with cancan disallowed' do
swap LinkToAction, use_cancan: true do
assert_equal nil, link_to_destroy(@user)
end
end
test 'link_to_back first time' do
assert_equal "Back",
link_to_back
end
test 'link_to_back with size' do
assert_equal "Back",
link_to_back(size: :mini)
end
test 'link_to_back using icons' do
swap LinkToAction, use_icons: true do
assert_equal " Back",
link_to_back
end
end
test 'link_to_back specifying icon' do
swap LinkToAction, use_icons: true do
assert_equal " Back",
link_to_back(icon: 'chevron-left')
end
end
test 'link_to_back specifying icon size' do
swap LinkToAction, use_icons: true do
assert_equal " Back",
link_to_back(icon_size: :small)
end
end
test 'link_to_back first time with classes' do
swap LinkToAction, use_classes: true do
assert_equal "Back",
link_to_back
end
end
end