Sha256: e74d23de3ece16c8e3541a05d23d818be7e9575c3c33585b39135ab077ed5c67
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' require 'json' describe GlobalizeTranslationsController do let(:i18n_title) { Factory(:i18n_title) } context "JSON" do describe "GET :index" do let(:translations) do i18n_title # needed so there is some data in the database before a call to get :index get :index, :format => :json JSON.parse(response.body) end it "returns a non-empty JSON" do translations.present?.should be_true end it "returns a JSON with default_locale" do translations["default_locale"].should eq(I18n.default_locale.to_s) end it "returns a JSON with translations" do i18n_title.value.should eq(translations["en"]["title"]) end end end context "HTML" do describe "GET :index" do context "without being logged in" do before do get :index, :format => :html end it { should respond_with(:forbidden) } end context "when being logged in as admin" do before do controller.stub!(:require_admin).and_return(true) get :index, :format => :html end it { should respond_with(:success) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exvo_globalize-0.0.2 | spec/controllers/globalize_translations_controller_spec.rb |