fix channel JSON response
This commit is contained in:
parent
ef77eb0ca4
commit
83fd941c10
@ -174,7 +174,7 @@ class ChannelsController < ApplicationController
|
||||
session[:errors] = nil
|
||||
end
|
||||
end
|
||||
format.json { render :json => @channel }
|
||||
format.json { render :json => @channel.as_json(Channel.public_options) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -33,6 +33,7 @@ describe ChannelsController do
|
||||
@channel.name.should eq('new name')
|
||||
response.should redirect_to channel_path(@channel.id)
|
||||
end
|
||||
|
||||
it "should allow a channel to be deleted " do
|
||||
delete :destroy, :id => @channel.id
|
||||
response.should redirect_to channels_path
|
||||
@ -134,6 +135,18 @@ describe ChannelsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "show channel" do
|
||||
it 'shows a channel' do
|
||||
get :show, id: @channel.id
|
||||
response.should be_successful
|
||||
end
|
||||
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([])
|
||||
end
|
||||
end
|
||||
|
||||
describe "create channel" do
|
||||
it 'creates a channel' do
|
||||
post :create, {:key => @user.api_key, :name => 'mychannel'}
|
||||
|
Loading…
Reference in New Issue
Block a user