mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
Write ApplicationHelper tests
This commit is contained in:
parent
38926d49db
commit
dc7bb420c8
35
test/helpers/application_helper_test.rb
Normal file
35
test/helpers/application_helper_test.rb
Normal file
@ -0,0 +1,35 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ApplicationHelperTest < ActionView::TestCase
|
||||
include ApplicationHelper
|
||||
|
||||
test "when user is logged-in, links characters" do
|
||||
log_in_user(:tolkien)
|
||||
|
||||
link = link_if_present "Frodo Baggins", "character"
|
||||
|
||||
assert_equal link_to("Frodo Baggins", characters(:frodo)), link
|
||||
end
|
||||
|
||||
test "when user is not logged-in, just returns the given name" do
|
||||
link = link_if_present "Frodo Baggins", "character"
|
||||
|
||||
assert_equal "Frodo Baggins", link
|
||||
end
|
||||
|
||||
test "when name is not found, just return the given name" do
|
||||
log_in_user(:tolkien)
|
||||
|
||||
link = link_if_present "Princess Zelda", "character"
|
||||
|
||||
assert_equal "Princess Zelda", link
|
||||
end
|
||||
|
||||
test "print_property makes a link" do
|
||||
log_in_user(:tolkien)
|
||||
|
||||
property = print_property "The Ring-Bearer", "Frodo Baggins", "character"
|
||||
|
||||
assert property.include? link_to("Frodo Baggins", characters(:frodo))
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user