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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/clearance/test/functional/users_controller_test.rb', line 6
def self.included(controller_test)
controller_test.class_eval do
should_filter_params :password
public_context do
context "When getting new User view" do
setup { get :new }
should_respond_with :success
should_render_template :new
should_not_set_the_flash
should_display_a_registration_form
end
context "Given email parameter when getting new User view" do
setup do
@email = "[email protected]"
get :new, :user => { :email => @email }
end
should "set assigned user's email" do
assert_equal @email, assigns(:user).email
end
end
context "Given valid attributes when creating a new user" do
setup do
user_attributes = Factory.attributes_for(:registered_user)
post :create, :user => user_attributes
end
should_create_user_successfully
end
end
signed_in_user_context do
context "GET to new" do
setup { get :new }
should_redirect_to "root_url"
end
context "POST to create" do
setup { post :create, :user => {} }
should_redirect_to "root_url"
end
end
end
end
|