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
|
2014-09-25 23:44:48 +08:00
|
|
|
(Admin::SiteTextController < Admin::AdminController).should == 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
|
2013-04-05 00:59:44 +08:00
|
|
|
response.should be_success
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns JSON' do
|
2014-09-25 02:45:35 +08:00
|
|
|
xhr :get, :show, id: text_type
|
2013-04-05 00:59:44 +08:00
|
|
|
::JSON.parse(response.body).should be_present
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|