Skip to content

Instantly share code, notes, and snippets.

@willrjmarshall
Created September 26, 2011 06:11
Show Gist options
  • Select an option

  • Save willrjmarshall/1241700 to your computer and use it in GitHub Desktop.

Select an option

Save willrjmarshall/1241700 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'ruby-debug'
describe BroadcastsController do
before :each do
@user = User.make!
sign_in :user, @user
end
describe "Basic crud functions" do
it "should paginate the broadcasts index" do
Broadcast.should_receive(:page).with("2")
get :index, :page => 2
end
#it "should find a broadcast" do
# Broadcast.should_receive(:find).with("3").and_return(broadcast = mock_model(Broadcast))
# get :show, :id => 3
# assigns(:broadcast).should == broadcast
#end
#it "should spawn a new empty broadcast on new" do
# get :new
# response.should_not be_redirect
# assigns(:broadcast).should be_a(Broadcast)
# assigns(:broadcast).user.should == @user
#end
it "should render edit" do
b = Broadcast.make!(:user => @user)
Broadcast.last.should == b
get :edit, :id => b.id
response.should render_template "broadcasts/edit"
end
#it "should save a broadcast on create" do
# controller.stub_chain(:current_user, :broadcasts, :build).and_return(broadcast = Broadcast.make)
# broadcast.should_receive(:save).and_return true
# post :create, :broadcast => {}
# response.should be_redirect
#end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment