add API commands to view a single Channel

This commit is contained in:
Lee Lawlor
2014-08-15 21:56:02 -04:00
parent 83fd941c10
commit 32dac9c9c7
11 changed files with 204 additions and 6 deletions

View File

@ -143,7 +143,21 @@ describe ChannelsController do
it 'returns JSON' do
get :show, id: @channel.id, format: 'json'
JSON.parse(response.body)['name'].should eq(@channel.name)
JSON.parse(response.body)['tags'].should eq([])
JSON.parse(response.body)['api_keys'].should be_nil
end
it 'returns JSON with private data' do
get :show, id: @channel.id, api_key: @user.api_key, format: 'json'
JSON.parse(response.body)['api_keys'].should_not be_nil
end
it 'returns XML' do
get :show, id: @channel.id, format: 'xml'
Nokogiri::XML(response.body).css('name').text.should eq(@channel.name)
Nokogiri::XML(response.body).css('api-keys').text.should be_blank
end
it 'returns XML with private data' do
@channel.add_write_api_key
get :show, id: @channel.id, api_key: @user.api_key, format: 'xml'
Nokogiri::XML(response.body).css('api-keys').text.should_not be_blank
end
end