Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'spec_helper'
require 'ruby-debug'
describe BroadcastsController do
before :each do
@user = User.make!
sign_in :user, @user
end
describe "JSON API" do
#it "should let me create a new broadcast for the current user" do
# post :create, :broadcast => {:name => "test"}, :format => :json
# response.should be_success
#end
#it "should fail when the broadcast cannot be created" do
# post :create, :broadcast => {}, :format => :json
# response.status.should == 422
#end
describe "with an existing broadcast" do
before :each do
@broadcast = Broadcast.make!(:user => @user)
end
#it "should let me update a broadcast" do
# @broadcast.name = "testy"
# put :update, :id => @broadcast.id, :broadcast => @broadcast.attributes, :format => :json
# response.should be_successful
# @broadcast.reload.name.should == "testy"
#end
#it "should fail when the broadcast update is invalid" do
# put :update, :id => @broadcast.id, :broadcast => {}, :format => :json
# response.status.should == 422
#end
it "should fail when the broadcast does not belong to the user" do
broadcast = Broadcast.make!(:user => User.make!)
put :update, :id => broadcast.id, :broadcast => broadcast.attributes, :format => :json
response.status.should == 403
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.