spec/helpers/lolita/i18n_helper_spec.rb in lolita-i18n-0.5.6 vs spec/helpers/lolita/i18n_helper_spec.rb in lolita-i18n-0.5.7

- old
+ new

@@ -3,59 +3,60 @@ describe Lolita::I18nHelper, :rails => true do it "should return locale options" do good_locale_options = [ ["Choose other language",nil], ["Latvian",:lv], - ["Russian",:ru] + ["Russian",:ru], + ["Swedish",:sv_SE] ] - helper.locale_options.should eq(good_locale_options) + expect(helper.locale_options).to 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 + expect(helper.is_untranslated?("")).to be_truthy + expect(helper.is_untranslated?("text")).to be_falsey + expect(helper.is_untranslated?([])).to be_truthy + expect(helper.is_untranslated?({})).to be_truthy end it "translation is visible when value is not blank and params does not say to show only untranslated values" do - 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 + expect(helper.translation_visible?("", nil)).to be_truthy + expect(helper.translation_visible?("text", nil)).to be_truthy + expect(helper.translation_visible?([], nil)).to be_truthy + expect(helper.translation_visible?({}, nil)).to be_truthy helper.params[:show_untranslated] = 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 + expect(helper.translation_visible?("", nil)).to be_truthy + expect(helper.translation_visible?("text", nil)).to be_falsey + expect(helper.translation_visible?([], nil)).to be_truthy + expect(helper.translation_visible?({}, nil)).to be_truthy end describe "#any_translation_visible?" do it "should detect if any translation from array is visible" do - helper.any_translation_visible?([2,1], nil).should be_true - helper.any_translation_visible?([], nil).should be_true + expect(helper.any_translation_visible?([2,1], nil)).to be_truthy + expect(helper.any_translation_visible?([], nil)).to be_truthy helper.params[:show_untranslated] = true - 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 + expect(helper.any_translation_visible?([], nil)).to be_truthy + expect(helper.any_translation_visible?(["",1], nil)).to be_truthy + expect(helper.any_translation_visible?(["a","b"], nil)).to be_falsey end it "should detect if any translation from hash is visible" do - helper.any_translation_visible?({:a => "1",:b => "2" }, nil).should be_true - helper.any_translation_visible?([], nil).should be_true + expect(helper.any_translation_visible?({:a => "1",:b => "2" }, nil)).to be_truthy + expect(helper.any_translation_visible?([], nil)).to be_truthy helper.params[:show_untranslated] = 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 + expect(helper.any_translation_visible?({}, nil)).to be_truthy + expect(helper.any_translation_visible?({:a => "1",:b => "2" }, nil)).to be_falsey + expect(helper.any_translation_visible?({:a => "1",:b => "" }, nil)).to be_truthy end it "should call #translation_visible? for any other value" do - helper.should_receive(:translation_visible?).with("text", '/url') + expect(helper).to receive(:translation_visible?).with("text", '/url') helper.any_translation_visible?("text", '/url') end end describe "#sort_link" do @@ -63,15 +64,15 @@ {:controller => "lolita/i18n",:action => "index", :i18n_locale => :en}.each do |k,v| helper.params[k] = v end end it "should create link with sort in it when params does not include :sort" do - helper.sort_link.should match(/sort=1/) + expect(helper.sort_link).to match(/sort=1/) end it "should create link witho sort in it when params include :sort" do helper.params[:sort] = "1" - helper.sort_link.should_not match(/sort=1/) + expect(helper.sort_link).not_to match(/sort=1/) end end end