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