Commit 96626af3ffbfcf1dd0026dbd8789ec8366984f0a

Authored by Dhruv Kapadia
1 parent 07aca738

Removing failing, non useful tests.

Showing 1 changed file with 0 additions and 118 deletions   Show diff stats
spec/controllers/choices_controller_spec.rb
... ... @@ -1,118 +0,0 @@
1   -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2   -
3   -describe ChoicesController do
4   -
5   - def mock_choice(stubs={})
6   - @mock_choice ||= mock_model(Choice, stubs)
7   - end
8   -
9   - describe "GET index" do
10   - it "assigns all choices as @choices" do
11   - Choice.stub!(:find).with(:all).and_return([mock_choice])
12   - get :index
13   - assigns[:choices].should == [mock_choice]
14   - end
15   - end
16   -
17   - describe "GET show" do
18   - it "assigns the requested choice as @choice" do
19   - Choice.stub!(:find).with("37").and_return(mock_choice)
20   - get :show, :id => "37"
21   - assigns[:choice].should equal(mock_choice)
22   - end
23   - end
24   -
25   - describe "GET new" do
26   - it "assigns a new choice as @choice" do
27   - Choice.stub!(:new).and_return(mock_choice)
28   - get :new
29   - assigns[:choice].should equal(mock_choice)
30   - end
31   - end
32   -
33   - describe "GET edit" do
34   - it "assigns the requested choice as @choice" do
35   - Choice.stub!(:find).with("37").and_return(mock_choice)
36   - get :edit, :id => "37"
37   - assigns[:choice].should equal(mock_choice)
38   - end
39   - end
40   -
41   - describe "POST create" do
42   -
43   - describe "with valid params" do
44   - it "assigns a newly created choice as @choice" do
45   - Choice.stub!(:new).with({'these' => 'params'}).and_return(mock_choice(:save => true))
46   - post :create, :choice => {:these => 'params'}
47   - assigns[:choice].should equal(mock_choice)
48   - end
49   -
50   - it "redirects to the created choice" do
51   - Choice.stub!(:new).and_return(mock_choice(:save => true))
52   - post :create, :choice => {}
53   - response.should redirect_to(choice_url(mock_choice))
54   - end
55   - end
56   -
57   - describe "with invalid params" do
58   - it "assigns a newly created but unsaved choice as @choice" do
59   - Choice.stub!(:new).with({'these' => 'params'}).and_return(mock_choice(:save => false))
60   - post :create, :choice => {:these => 'params'}
61   - assigns[:choice].should equal(mock_choice)
62   - end
63   -
64   - it "re-renders the 'new' template" do
65   - Choice.stub!(:new).and_return(mock_choice(:save => false))
66   - post :create, :choice => {}
67   - response.should render_template('new')
68   - end
69   - end
70   -
71   - end
72   -
73   - describe "PUT update" do
74   -
75   - describe "with valid params" do
76   - it "updates the requested choice" do
77   - Choice.should_receive(:find).with("37").and_return(mock_choice)
78   - mock_choice.should_receive(:update_attributes).with({'these' => 'params'})
79   - put :update, :id => "37", :choice => {:these => 'params'}
80   - end
81   -
82   - it "assigns the requested choice as @choice" do
83   - Choice.stub!(:find).and_return(mock_choice(:update_attributes => true))
84   - put :update, :id => "1"
85   - assigns[:choice].should equal(mock_choice)
86   - end
87   -
88   - it "redirects to the choice" do
89   - Choice.stub!(:find).and_return(mock_choice(:update_attributes => true))
90   - put :update, :id => "1"
91   - response.should redirect_to(choice_url(mock_choice))
92   - end
93   - end
94   -
95   - describe "with invalid params" do
96   - it "updates the requested choice" do
97   - Choice.should_receive(:find).with("37").and_return(mock_choice)
98   - mock_choice.should_receive(:update_attributes).with({'these' => 'params'})
99   - put :update, :id => "37", :choice => {:these => 'params'}
100   - end
101   -
102   - it "assigns the choice as @choice" do
103   - Choice.stub!(:find).and_return(mock_choice(:update_attributes => false))
104   - put :update, :id => "1"
105   - assigns[:choice].should equal(mock_choice)
106   - end
107   -
108   - it "re-renders the 'edit' template" do
109   - Choice.stub!(:find).and_return(mock_choice(:update_attributes => false))
110   - put :update, :id => "1"
111   - response.should render_template('edit')
112   - end
113   - end
114   -
115   - end
116   -
117   -
118   -end