Created
October 5, 2011 01:28
-
-
Save willrjmarshall/1263387 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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