Sha256: 1de485b76c0325f14783873bac6afe4806912daaa474eb756d7fc91dd04de0e0

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

# encoding: utf-8
require "spec_helper"

module Refinery
  module AdminLocales
    module Admin
      describe AdminLocalesController do
        render_views
        refinery_login_with_factory :refinery_user

        before(:each) do
          Refinery::User.first.update_attribute(:locale, locale)
          get :index
        end

        context "without locale" do
          let(:locale) { nil }

          it { response.should be_success }
          it { response.should render_template(:index) }
          it { response.body.should match("Switch to your website") }
          it { ::I18n.locale.should eq ::Refinery::I18n.current_locale }
        end

        context "with en locale" do
          let(:locale) { :en }

          it { response.should be_success }
          it { response.should render_template(:index) }
          it { response.body.should match("Switch to your website") }
          it { ::Refinery::I18n.current_locale.should eq "en" }
          it { ::I18n.locale.should eq :en }
        end

        context "with en locale" do
          let(:locale) { :es }

          it { response.should be_success }
          it { response.should render_template(:index) }
          it { response.body.should match("Ver tu web") }
          it { ::Refinery::I18n.current_locale.should eq "es" }
          it { ::I18n.locale.should eq :es }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-admin-locales-2.0.0 spec/controllers/refinery/admin_locales/admin/admin_locales_spec.rb
refinerycms-admin-locales-2.1.0.dev spec/controllers/refinery/admin_locales/admin/admin_locales_spec.rb