Blob of spec/controllers/site_controller_spec.rb (raw blob data)

1 require File.dirname(__FILE__) + '/../spec_helper'
2
3 describe SiteController do
4
5 describe "#index" do
6 it "GETs sucessfully" do
7 get :index
8 response.should be_success
9 end
10
11 it "gets a list of the most recent projects" do
12 get :index
13 assigns[:projects].should == Project.find(:all, :limit => 5, :order => "id desc")
14 end
15 end
16
17 describe "#dashboard" do
18 before(:each) do
19 login_as :johan
20 end
21
22 it "GETs successfully" do
23 get :dashboard
24 response.should be_success
25 response.should render_template("site/dashboard")
26 end
27
28 it "requires login" do
29 login_as nil
30 get :dashboard
31 response.should redirect_to(new_sessions_path)
32 end
33
34 it "get a list of the current_users projects" do
35 get :dashboard
36 assigns[:projects].should == [*projects(:johans)]
37 end
38
39 it "get a list of the current_users repositories, that's not mainline" do
40 get :dashboard
41 assigns[:repositories].should == [repositories(:johans_moe_clone)]
42 end
43 end
44
45 end