spec/helpers/lolita/i18n_helper_spec.rb in lolita-i18n-0.5.2 vs spec/helpers/lolita/i18n_helper_spec.rb in lolita-i18n-0.5.3

- old
+ new

@@ -8,48 +8,55 @@ ["Russian",:ru] ] helper.locale_options.should eq(good_locale_options) end + it "#is_untranslated?" do + helper.is_untranslated?("").should be_true + helper.is_untranslated?("text").should be_false + helper.is_untranslated?([]).should be_true + helper.is_untranslated?({}).should be_true + end + it "translation is visible when value is not blank and params does not say to show only untranslated values" do - helper.translation_visible?("").should be_true - helper.translation_visible?("text").should be_true - helper.translation_visible?([]).should be_true - helper.translation_visible?({}).should be_true + helper.translation_visible?("", nil).should be_true + helper.translation_visible?("text", nil).should be_true + helper.translation_visible?([], nil).should be_true + helper.translation_visible?({}, nil).should be_true helper.params[:show_untranslated] = true - helper.translation_visible?("").should be_true - helper.translation_visible?("text").should be_false - helper.translation_visible?([]).should be_true - helper.translation_visible?({}).should be_true + helper.translation_visible?("", nil).should be_true + helper.translation_visible?("text", nil).should be_false + helper.translation_visible?([], nil).should be_true + helper.translation_visible?({}, nil).should be_true end describe "#any_translation_visible?" do it "should detect if any translation from array is visible" do - helper.any_translation_visible?([2,1]).should be_true - helper.any_translation_visible?([]).should be_true + helper.any_translation_visible?([2,1], nil).should be_true + helper.any_translation_visible?([], nil).should be_true helper.params[:show_untranslated] = true - helper.any_translation_visible?([]).should be_true - helper.any_translation_visible?(["",1]).should be_true - helper.any_translation_visible?(["a","b"]).should be_false + helper.any_translation_visible?([], nil).should be_true + helper.any_translation_visible?(["",1], nil).should be_true + helper.any_translation_visible?(["a","b"], nil).should be_false end it "should detect if any translation from hash is visible" do - helper.any_translation_visible?({:a => "1",:b => "2" }).should be_true - helper.any_translation_visible?([]).should be_true + helper.any_translation_visible?({:a => "1",:b => "2" }, nil).should be_true + helper.any_translation_visible?([], nil).should be_true helper.params[:show_untranslated] = true - helper.any_translation_visible?({}).should be_true - helper.any_translation_visible?({:a => "1",:b => "2" }).should be_false - helper.any_translation_visible?({:a => "1",:b => "" }).should be_true + helper.any_translation_visible?({}, nil).should be_true + helper.any_translation_visible?({:a => "1",:b => "2" }, nil).should be_false + helper.any_translation_visible?({:a => "1",:b => "" }, nil).should be_true end it "should call #translation_visible? for any other value" do - helper.should_receive(:translation_visible?).with("text") - helper.any_translation_visible?("text") + helper.should_receive(:translation_visible?).with("text", '/url') + helper.any_translation_visible?("text", '/url') end end describe "#sort_link" do before(:each) do @@ -65,6 +72,6 @@ helper.params[:sort] = "1" helper.sort_link.should_not match(/sort=1/) end end -end \ No newline at end of file +end