Skip to content

Commit

Permalink
add tests for url helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklynhma committed Dec 15, 2024
1 parent 1f79184 commit 7fcdc6b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/unit/helpers/url_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require "test_helper"

class UrlHelperTest < ActionView::TestCase
context"append_https" do
should "return url if it begins with https" do
assert_equal "https://www.awesomesite.com", append_https("https://www.awesomesite.com")
end
should "return empty string if url is empty" do
assert_equal "", append_https("")
end

should "return link with https if it does not begin with https" do
assert_equal "https://javascript:alert('hello');", append_https("javascript:alert('hello');")
end

should "return empty string if url is nil" do
assert_equal "", append_https(nil)
end
end
end

0 comments on commit 7fcdc6b

Please sign in to comment.