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