blob: 88341f40f9dd1cd14b51300a02bdb61399673c72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
require "spec_helper"
describe SignUpsController do
describe "GET new" do
it "should show signup form" do
get :new
assigns(:sign_up).should be_a_new(SignUp)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new SignUp" do
SignUp.any_instance.should_receive(:subscribe)
post :create, { sign_up: { email: "customer@example.com" } }
SignUp.count.should == 1
end
end
describe "with invalid params" do
before :each do
post :create, { sign_up: { email: "invalidemailaddress" } }
end
it "goes back to the sign up form with errors" do
SignUp.count.should == 0
end
it "should display errors" do
assigns(:sign_up).errors.count.should > 0
end
end
end
end
|