Created
October 23, 2008 22:18
-
-
Save skrat/19233 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 File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') | |
given "logged in" do | |
login | |
end | |
describe Posts do | |
describe "index action" do | |
it "should respond correctly" do | |
dispatch_to(Posts, :index).should respond_successfully | |
end | |
it "should fetch all posts" do | |
Post.should_receive(:all) | |
dispatch_to(Posts, :index) do |controller| | |
controller.stub!(:display) | |
end | |
end | |
context "with user logged in", :given => "logged in" do | |
it "should set new post" do | |
Post.should_receive(:new) | |
dispatch_to(Posts, :index).should respond_successfully | |
end | |
User.all.destroy! | |
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
def login | |
u = User.new(chucks_attributes) | |
u.save | |
rack = request(:login, :method => "POST", | |
:params => {:login => chucks_attributes[:login], :password => chucks_attributes[:password]}) | |
end | |
alias logging_in login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment