2016-08-26 04:33:29 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe ExtraLocalesController do
|
|
|
|
|
|
|
|
context 'show' do
|
2016-09-01 01:35:49 +08:00
|
|
|
before do
|
|
|
|
I18n.locale = :en
|
|
|
|
I18n.reload!
|
|
|
|
end
|
2016-08-26 04:33:29 +08:00
|
|
|
|
|
|
|
it "needs a valid bundle" do
|
|
|
|
get :show, bundle: 'made-up-bundle'
|
|
|
|
expect(response).to_not be_success
|
|
|
|
expect(response.body).to be_blank
|
|
|
|
end
|
|
|
|
|
|
|
|
it "won't work with a weird parameter" do
|
|
|
|
get :show, bundle: '-invalid..character!!'
|
|
|
|
expect(response).to_not be_success
|
|
|
|
end
|
2016-09-29 04:26:36 +08:00
|
|
|
|
|
|
|
it "should include plugin translations" do
|
|
|
|
JsLocaleHelper.expects(:plugin_translations).with("en").returns({
|
|
|
|
"admin_js" => {
|
|
|
|
"admin" => {
|
|
|
|
"site_settings" => {
|
|
|
|
"categories" => {
|
|
|
|
"github_badges" => "Github Badges"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).at_least_once
|
|
|
|
|
|
|
|
get :show, bundle: "admin"
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
expect(response.body.include?("github_badges")).to eq(true)
|
|
|
|
end
|
|
|
|
|
2016-08-26 04:33:29 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|