2013-04-05 00:59:44 +08:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2014-09-25 02:45:35 +08:00
|
|
|
describe Admin::SiteTextController do
|
2013-04-05 00:59:44 +08:00
|
|
|
|
|
|
|
it "is a subclass of AdminController" do
|
2015-01-10 01:04:02 +08:00
|
|
|
expect(Admin::SiteTextController < Admin::AdminController).to eq(true)
|
2013-04-05 00:59:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'while logged in as an admin' do
|
|
|
|
before do
|
|
|
|
@user = log_in(:admin)
|
|
|
|
end
|
|
|
|
|
|
|
|
context '.show' do
|
2014-09-25 02:45:35 +08:00
|
|
|
let(:text_type) { SiteText.text_types.first.text_type }
|
2013-04-05 00:59:44 +08:00
|
|
|
|
|
|
|
it 'returns success' do
|
2014-09-25 02:45:35 +08:00
|
|
|
xhr :get, :show, id: text_type
|
2015-01-10 01:04:02 +08:00
|
|
|
expect(response).to be_success
|
2013-04-05 00:59:44 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns JSON' do
|
2014-09-25 02:45:35 +08:00
|
|
|
xhr :get, :show, id: text_type
|
2015-01-10 01:04:02 +08:00
|
|
|
expect(::JSON.parse(response.body)).to be_present
|
2013-04-05 00:59:44 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|