genderize 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,160 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # This spec was generated by rspec-rails when you ran the scaffold generator.
4
- # It demonstrates how one might use RSpec to specify the controller code that
5
- # was generated by Rails when you ran the scaffold generator.
6
- #
7
- # It assumes that the implementation code is generated by the rails scaffold
8
- # generator. If you are using any extension libraries to generate different
9
- # controller code, this generated spec may or may not pass.
10
- #
11
- # It only uses APIs available in rails and/or rspec-rails. There are a number
12
- # of tools you can use to make these specs even more expressive, but we're
13
- # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
- #
15
- # Compared to earlier versions of this generator, there is very limited use of
16
- # stubs and message expectations in this spec. Stubs are only used when there
17
- # is no simpler way to get a handle on the object needed for the example.
18
- # Message expectations are only used when there is no simpler way to specify
19
- # that an instance is receiving a specific message.
20
-
21
- describe UsersController do
22
-
23
- # This should return the minimal set of attributes required to create a valid
24
- # User. As you add validations to User, be sure to
25
- # adjust the attributes here as well.
26
- let(:valid_attributes) { { "new" => "MyString" } }
27
-
28
- # This should return the minimal set of values that should be in the session
29
- # in order to pass any filters (e.g. authentication) defined in
30
- # UsersController. Be sure to keep this updated too.
31
- let(:valid_session) { {} }
32
-
33
- describe "GET index" do
34
- it "assigns all users as @users" do
35
- user = User.create! valid_attributes
36
- get :index, {}, valid_session
37
- assigns(:users).should eq([user])
38
- end
39
- end
40
-
41
- describe "GET show" do
42
- it "assigns the requested user as @user" do
43
- user = User.create! valid_attributes
44
- get :show, {:id => user.to_param}, valid_session
45
- assigns(:user).should eq(user)
46
- end
47
- end
48
-
49
- describe "GET new" do
50
- it "assigns a new user as @user" do
51
- get :new, {}, valid_session
52
- assigns(:user).should be_a_new(User)
53
- end
54
- end
55
-
56
- describe "GET edit" do
57
- it "assigns the requested user as @user" do
58
- user = User.create! valid_attributes
59
- get :edit, {:id => user.to_param}, valid_session
60
- assigns(:user).should eq(user)
61
- end
62
- end
63
-
64
- describe "POST create" do
65
- describe "with valid params" do
66
- it "creates a new User" do
67
- expect {
68
- post :create, {:user => valid_attributes}, valid_session
69
- }.to change(User, :count).by(1)
70
- end
71
-
72
- it "assigns a newly created user as @user" do
73
- post :create, {:user => valid_attributes}, valid_session
74
- assigns(:user).should be_a(User)
75
- assigns(:user).should be_persisted
76
- end
77
-
78
- it "redirects to the created user" do
79
- post :create, {:user => valid_attributes}, valid_session
80
- response.should redirect_to(User.last)
81
- end
82
- end
83
-
84
- describe "with invalid params" do
85
- it "assigns a newly created but unsaved user as @user" do
86
- # Trigger the behavior that occurs when invalid params are submitted
87
- User.any_instance.stub(:save).and_return(false)
88
- post :create, {:user => { "new" => "invalid value" }}, valid_session
89
- assigns(:user).should be_a_new(User)
90
- end
91
-
92
- it "re-renders the 'new' template" do
93
- # Trigger the behavior that occurs when invalid params are submitted
94
- User.any_instance.stub(:save).and_return(false)
95
- post :create, {:user => { "new" => "invalid value" }}, valid_session
96
- response.should render_template("new")
97
- end
98
- end
99
- end
100
-
101
- describe "PUT update" do
102
- describe "with valid params" do
103
- it "updates the requested user" do
104
- user = User.create! valid_attributes
105
- # Assuming there are no other users in the database, this
106
- # specifies that the User created on the previous line
107
- # receives the :update_attributes message with whatever params are
108
- # submitted in the request.
109
- User.any_instance.should_receive(:update_attributes).with({ "new" => "MyString" })
110
- put :update, {:id => user.to_param, :user => { "new" => "MyString" }}, valid_session
111
- end
112
-
113
- it "assigns the requested user as @user" do
114
- user = User.create! valid_attributes
115
- put :update, {:id => user.to_param, :user => valid_attributes}, valid_session
116
- assigns(:user).should eq(user)
117
- end
118
-
119
- it "redirects to the user" do
120
- user = User.create! valid_attributes
121
- put :update, {:id => user.to_param, :user => valid_attributes}, valid_session
122
- response.should redirect_to(user)
123
- end
124
- end
125
-
126
- describe "with invalid params" do
127
- it "assigns the user as @user" do
128
- user = User.create! valid_attributes
129
- # Trigger the behavior that occurs when invalid params are submitted
130
- User.any_instance.stub(:save).and_return(false)
131
- put :update, {:id => user.to_param, :user => { "new" => "invalid value" }}, valid_session
132
- assigns(:user).should eq(user)
133
- end
134
-
135
- it "re-renders the 'edit' template" do
136
- user = User.create! valid_attributes
137
- # Trigger the behavior that occurs when invalid params are submitted
138
- User.any_instance.stub(:save).and_return(false)
139
- put :update, {:id => user.to_param, :user => { "new" => "invalid value" }}, valid_session
140
- response.should render_template("edit")
141
- end
142
- end
143
- end
144
-
145
- describe "DELETE destroy" do
146
- it "destroys the requested user" do
147
- user = User.create! valid_attributes
148
- expect {
149
- delete :destroy, {:id => user.to_param}, valid_session
150
- }.to change(User, :count).by(-1)
151
- end
152
-
153
- it "redirects to the users list" do
154
- user = User.create! valid_attributes
155
- delete :destroy, {:id => user.to_param}, valid_session
156
- response.should redirect_to(users_url)
157
- end
158
- end
159
-
160
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # Specs in this file have access to a helper object that includes
4
- # the UsersHelper. For example:
5
- #
6
- # describe UsersHelper do
7
- # describe "string concat" do
8
- # it "concats two strings with spaces" do
9
- # helper.concat_strings("this","that").should == "this that"
10
- # end
11
- # end
12
- # end
13
- describe UsersHelper do
14
- pending "add some examples to (or delete) #{__FILE__}"
15
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Users" do
4
- describe "GET /users" do
5
- it "works! (now write some real specs)" do
6
- # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
7
- get users_path
8
- response.status.should be(200)
9
- end
10
- end
11
- end
@@ -1,35 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe UsersController do
4
- describe "routing" do
5
-
6
- it "routes to #index" do
7
- get("/users").should route_to("users#index")
8
- end
9
-
10
- it "routes to #new" do
11
- get("/users/new").should route_to("users#new")
12
- end
13
-
14
- it "routes to #show" do
15
- get("/users/1").should route_to("users#show", :id => "1")
16
- end
17
-
18
- it "routes to #edit" do
19
- get("/users/1/edit").should route_to("users#edit", :id => "1")
20
- end
21
-
22
- it "routes to #create" do
23
- post("/users").should route_to("users#create")
24
- end
25
-
26
- it "routes to #update" do
27
- put("/users/1").should route_to("users#update", :id => "1")
28
- end
29
-
30
- it "routes to #destroy" do
31
- delete("/users/1").should route_to("users#destroy", :id => "1")
32
- end
33
-
34
- end
35
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "users/edit" do
4
- before(:each) do
5
- @user = assign(:user, stub_model(User,
6
- :new => "MyString",
7
- :index => "MyString",
8
- :show => "MyString"
9
- ))
10
- end
11
-
12
- it "renders the edit user form" do
13
- render
14
-
15
- # Run the generator again with the --webrat flag if you want to use webrat matchers
16
- assert_select "form[action=?][method=?]", user_path(@user), "post" do
17
- assert_select "input#user_new[name=?]", "user[new]"
18
- assert_select "input#user_index[name=?]", "user[index]"
19
- assert_select "input#user_show[name=?]", "user[show]"
20
- end
21
- end
22
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "users/index" do
4
- before(:each) do
5
- assign(:users, [
6
- stub_model(User,
7
- :new => "New",
8
- :index => "Index",
9
- :show => "Show"
10
- ),
11
- stub_model(User,
12
- :new => "New",
13
- :index => "Index",
14
- :show => "Show"
15
- )
16
- ])
17
- end
18
-
19
- it "renders a list of users" do
20
- render
21
- # Run the generator again with the --webrat flag if you want to use webrat matchers
22
- assert_select "tr>td", :text => "New".to_s, :count => 2
23
- assert_select "tr>td", :text => "Index".to_s, :count => 2
24
- assert_select "tr>td", :text => "Show".to_s, :count => 2
25
- end
26
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "users/new" do
4
- before(:each) do
5
- assign(:user, stub_model(User,
6
- :new => "MyString",
7
- :index => "MyString",
8
- :show => "MyString"
9
- ).as_new_record)
10
- end
11
-
12
- it "renders new user form" do
13
- render
14
-
15
- # Run the generator again with the --webrat flag if you want to use webrat matchers
16
- assert_select "form[action=?][method=?]", users_path, "post" do
17
- assert_select "input#user_new[name=?]", "user[new]"
18
- assert_select "input#user_index[name=?]", "user[index]"
19
- assert_select "input#user_show[name=?]", "user[show]"
20
- end
21
- end
22
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "users/show" do
4
- before(:each) do
5
- @user = assign(:user, stub_model(User,
6
- :new => "New",
7
- :index => "Index",
8
- :show => "Show"
9
- ))
10
- end
11
-
12
- it "renders attributes in <p>" do
13
- render
14
- # Run the generator again with the --webrat flag if you want to use webrat matchers
15
- rendered.should match(/New/)
16
- rendered.should match(/Index/)
17
- rendered.should match(/Show/)
18
- end
19
- end