Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action buttons for pitch approval; display status on myspot pitches i…
…ndex
- Loading branch information
Showing
7 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') | |||
|
|||
describe Admin::PitchesController do | |||
route_matches('/admin/pitches', :get, :controller => 'admin/pitches', :action => 'index') | |||
route_matches('/admin/pitches/1/approve', :put, :controller => 'admin/pitches', :action => 'approve', :id => '1') | |||
route_matches('/admin/pitches/1/unapprove', :put, :controller => 'admin/pitches', :action => 'unapprove', :id => '1') | |||
|
|||
before do | |||
controller.stub!(:current_user).and_return(Factory(:admin)) | |||
end | |||
|
|||
describe "approve" do | |||
before do | |||
@pitch = Factory(:pitch) | |||
controller.stub!(:redirect_to) | |||
end | |||
it "should set a flash message" do | |||
put :approve, :id => @pitch.id | |||
flash[:success].should_not be_nil | |||
end | |||
it "should redirect back" do | |||
controller.should_receive(:redirect_to).with(:back) | |||
put :approve, :id => @pitch.id | |||
end | |||
end | |||
|
|||
describe "unapprove" do | |||
before do | |||
@pitch = active_pitch | |||
controller.stub!(:redirect_to) | |||
end | |||
it "should set a flash message" do | |||
put :unapprove, :id => @pitch.id | |||
flash[:success].should_not be_nil | |||
end | |||
it "should redirect back" do | |||
controller.should_receive(:redirect_to).with(:back) | |||
put :unapprove, :id => @pitch.id | |||
end | |||
end | |||
end |
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
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
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
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
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
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