File tree 1 file changed +49
-0
lines changed
pages/spec/helpers/refinery/pages/admin
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,55 @@ module Admin
49
49
end
50
50
end
51
51
end
52
+
53
+ describe "#page_meta_information" do
54
+ let ( :page ) { FactoryGirl . build ( :page ) }
55
+
56
+ context "when show_in_menu is false" do
57
+ it "adds 'hidden' label" do
58
+ page . show_in_menu = false
59
+
60
+ helper . page_meta_information ( page ) . should eq ( "<span class=\" label\" >hidden</span>" )
61
+ end
62
+ end
63
+
64
+ context "when draft is true" do
65
+ it "adds 'draft' label" do
66
+ page . draft = true
67
+
68
+ helper . page_meta_information ( page ) . should eq ( "<span class=\" label notice\" >draft</span>" )
69
+ end
70
+ end
71
+ end
72
+
73
+ describe "#page_title_with_translations" do
74
+ let ( :page ) { FactoryGirl . build ( :page ) }
75
+
76
+ before do
77
+ Globalize . with_locale ( :en ) do
78
+ page . title = "draft"
79
+ page . save!
80
+ end
81
+
82
+ Globalize . with_locale ( :lv ) do
83
+ page . title = "melnraksts"
84
+ page . save!
85
+ end
86
+ end
87
+
88
+ context "when title is present" do
89
+ it "returns it" do
90
+ helper . page_title_with_translations ( page ) . should eq ( "draft" )
91
+ end
92
+ end
93
+
94
+ context "when title for current locale isn't available" do
95
+ it "returns existing title from translations" do
96
+ Refinery ::Page ::Translation . where ( :locale => :en ) . first . delete
97
+ helper . page_title_with_translations ( page ) . should eq ( "melnraksts" )
98
+ end
99
+ end
100
+ end
52
101
end
53
102
end
54
103
end
You can’t perform that action at this time.
0 commit comments