scidea-hsfc-policies 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,10 @@ module Scidea
|
|
5
5
|
module PoliciesHelper
|
6
6
|
|
7
7
|
def hsfc_policies_label(locale, setting_name, t_key)
|
8
|
-
|
8
|
+
link_tag = Setting.value(setting_name)
|
9
9
|
label = t(t_key)
|
10
|
-
link_text = label.match(/<a>([^<]*)<\/a>/)[1]
|
11
10
|
|
12
|
-
|
13
|
-
label.sub( /<a>([^<]*)<\/a>/, link_to(link_text, "#{url}#{sep}locale=#{locale}") ).html_safe
|
11
|
+
label.sub(/<a>([^<]*)<\/a>/, link_tag).html_safe
|
14
12
|
end
|
15
13
|
|
16
14
|
def hsfc_policies_privacy_policy_label(locale)
|
@@ -5,24 +5,24 @@ describe Scidea::Hsfc::Policies::Helpers::PoliciesHelper do
|
|
5
5
|
|
6
6
|
describe "hsfc_policies_privacy_policy_label" do
|
7
7
|
before do
|
8
|
-
helper.stub(:'t').and_return("This is the <a>policy</a>")
|
9
|
-
Setting.stub(:value).and_return("
|
8
|
+
helper.stub(:'t').and_return("This is the <a>policy</a> end")
|
9
|
+
Setting.stub(:value).and_return("<a href=\"\">Blah!</a>")
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should return the translation with the url interpolated" do
|
13
|
-
helper.hsfc_policies_privacy_policy_label(locale).should == "This is the <a href=\"
|
13
|
+
helper.hsfc_policies_privacy_policy_label(locale).should == "This is the <a href=\"\">Blah!</a> end"
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "hsfc_policies_terms_label" do
|
19
19
|
before do
|
20
|
-
helper.stub(:'t').and_return("This is the <a>terms</a>")
|
21
|
-
Setting.stub(:value).and_return("
|
20
|
+
helper.stub(:'t').and_return("This is the <a>terms</a> end")
|
21
|
+
Setting.stub(:value).and_return("<a href=\"#\">blah</a>")
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should return the translation with the url interpolated" do
|
25
|
-
helper.hsfc_policies_terms_label(locale).should == "This is the <a href=\"
|
25
|
+
helper.hsfc_policies_terms_label(locale).should == "This is the <a href=\"#\">blah</a> end"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end #describe
|