-
-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25412b2
commit 7680b1e
Showing
4 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
require "test_helper" | ||
|
||
class UrlHelperTest < ActionView::TestCase | ||
context "append_https" do | ||
context "prepend_https" do | ||
should "return url if it begins with https" do | ||
assert_equal "https://www.awesomesite.com", append_https("https://www.awesomesite.com") | ||
assert_equal "https://www.awesomesite.com", prepend_https("https://www.awesomesite.com") | ||
end | ||
should "return empty string if url is empty" do | ||
assert_equal "", append_https("") | ||
assert_equal "", prepend_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');") | ||
assert_equal "https://javascript:alert('hello');", prepend_https("javascript:alert('hello');") | ||
end | ||
|
||
should "return empty string if url is nil" do | ||
assert_equal "", append_https(nil) | ||
assert_equal "", prepend_https(nil) | ||
end | ||
end | ||
end |