Created
October 18, 2012 11:18
-
-
Save cmilfont/3911139 to your computer and use it in GitHub Desktop.
Can i TDD My Spikes?
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
# -*- encoding : utf-8 -*- | |
require 'spec_helper' | |
describe GraduationsController do | |
describe "GET belts" do | |
before do | |
@belts = [] | |
7.times {|n| @belts << FactoryGirl.create(:belt, :name => "#{n} belt" )} | |
Belt.stub(:all).and_return @belts | |
end | |
it "should list all belts" do | |
get :belts, :format => :json | |
assigns[:belts].should == @belts | |
assigns[:belts].should have(7).belts | |
end | |
end | |
describe "POST create" do | |
before do | |
@graduation = Graduation.new :id => 1 | |
@belt = Belt.new :id => 1 | |
@graduation.stub(:belt_to).and_return @belt | |
controller.stub_chain(:current_user, :profile, :graduate_your_student).and_return(@graduation) | |
end | |
# @graduation = current_user.profile.graduate_your_student params[:student_id], params[:belt_id] | |
# respond_with @graduation, :include => :belt_to | |
it "graduate your student" do | |
post :create, :format => :json, :student_id => 1, :belt_id => 1 | |
assigns[:graduation].should == @graduation | |
assigns[:graduation].belt_to.should == @belt | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment