Replace MultisiteI18n hack with SiteContent and admin editing.

This commit is contained in:
Robin Ward
2013-04-05 16:47:20 -04:00
parent 52f79e8096
commit a14f62766e
8 changed files with 16 additions and 82 deletions

View File

@@ -1,37 +0,0 @@
require 'spec_helper'
require_dependency 'multisite_i18n'
describe MultisiteI18n do
before do
I18n.stubs(:t).with('test', {}).returns('default i18n')
MultisiteI18n.stubs(:translation_or_nil).with("default.test", {}).returns(nil)
MultisiteI18n.stubs(:translation_or_nil).with("other_site.test", {}).returns("overwritten i18n")
end
context "no value for a multisite key" do
it "it returns the default i18n key" do
MultisiteI18n.site_translate('default', 'test').should == "default i18n"
end
end
context "with a value for the multisite key" do
it "returns the overwritten value" do
MultisiteI18n.site_translate('other_site', 'test').should == "overwritten i18n"
end
end
context "when we call t, it uses the current site" do
it "returns the original" do
MultisiteI18n.t('test').should == 'default i18n'
end
it "returns the overwritten" do
RailsMultisite::ConnectionManagement.stubs(:current_db).returns('other_site')
MultisiteI18n.t('test').should == "overwritten i18n"
end
end
end

View File

@@ -26,7 +26,7 @@ describe EducationController do
let(:html_content) {"HTML Content"}
before do
MultisiteI18n.expects(:t).with("education.new-topic", anything).returns(markdown_content)
SiteContent.expects(:content_for).with(:education_new_topic, anything).returns(markdown_content)
PrettyText.expects(:cook).with(markdown_content).returns(html_content)
xhr :get, :show, id: 'new-topic'
end