Sha256: f930606baef9acc749b08fdb11ebfa8f41cba1ebe7ff750f4f6effe22e47fb48

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe I18nSimplePagesController do
  render_views

  describe "template rendering" do
    describe "contact page" do
      before { get :show, :id => "contact" }

      it { should render_template "contact" }
    end

    describe "página de contato" do
      context "when the locale param is defined" do
        before { get :show, :id => "contato", :locale => "pt" }

        it { should render_template "i18n_simple_pages/pt/contato" }

        it "should define the locale" do
          I18n.locale.should == :pt
        end

        after { I18n.locale = I18n.default_locale }
      end

      context "when the locale param is not defined" do
        before { get :show, :id => "contato" }

        it { should render_template "not_found" }
      end

      context "when the locale is defined" do
        before do
          I18n.locale = "pt"
          get :show, :id => "contato"
        end

        it { should render_template "i18n_simple_pages/pt/contato" }

        after { I18n.locale = I18n.default_locale }
      end

      context "when the locale param is not defined" do
        before { get :show, :id => "contato" }

        it { should render_template "not_found" }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_pages-0.1.1 spec/controllers/i18n_simple_pages_controller_spec.rb
simple_pages-0.1.0 spec/controllers/i18n_simple_pages_controller_spec.rb