Commit 6191e44e3ee4dfef6a78c5dfe9cf96d41f6e04e1
1 parent
e0ff252a
Exists in
master
and in
1 other branch
per_page field at user profile page
Showing
2 changed files
with
15 additions
and
0 deletions
Show diff stats
app/views/users/_fields.html.haml
| @@ -7,6 +7,10 @@ | @@ -7,6 +7,10 @@ | ||
| 7 | .required | 7 | .required |
| 8 | = f.label :email | 8 | = f.label :email |
| 9 | = f.text_field :email | 9 | = f.text_field :email |
| 10 | + | ||
| 11 | +.required | ||
| 12 | + = f.label 'Entries per page' | ||
| 13 | + = f.select :per_page, [10, 20, 30, 50, 75, 100] | ||
| 10 | 14 | ||
| 11 | .required | 15 | .required |
| 12 | = f.label :password | 16 | = f.label :password |
spec/controllers/users_controller_spec.rb
| 1 | require 'spec_helper' | 1 | require 'spec_helper' |
| 2 | 2 | ||
| 3 | describe UsersController do | 3 | describe UsersController do |
| 4 | + render_views | ||
| 4 | 5 | ||
| 5 | it_requires_authentication | 6 | it_requires_authentication |
| 6 | it_requires_admin_privileges :for => { | 7 | it_requires_admin_privileges :for => { |
| @@ -28,6 +29,11 @@ describe UsersController do | @@ -28,6 +29,11 @@ describe UsersController do | ||
| 28 | get :edit, :id => @user.id | 29 | get :edit, :id => @user.id |
| 29 | assigns(:user).should == @user | 30 | assigns(:user).should == @user |
| 30 | end | 31 | end |
| 32 | + | ||
| 33 | + it "should have per_page option" do | ||
| 34 | + get :edit, :id => @user.id | ||
| 35 | + response.body.should match(/id="user_per_page"/) | ||
| 36 | + end | ||
| 31 | end | 37 | end |
| 32 | 38 | ||
| 33 | context "PUT /users/:other_id" do | 39 | context "PUT /users/:other_id" do |
| @@ -53,6 +59,11 @@ describe UsersController do | @@ -53,6 +59,11 @@ describe UsersController do | ||
| 53 | put :update, :id => @user.to_param, :user => {:admin => true} | 59 | put :update, :id => @user.to_param, :user => {:admin => true} |
| 54 | @user.reload.admin.should be_false | 60 | @user.reload.admin.should be_false |
| 55 | end | 61 | end |
| 62 | + | ||
| 63 | + it "should be able to set per_page option" do | ||
| 64 | + put :update, :id => @user.to_param, :user => {:per_page => 555} | ||
| 65 | + @user.reload.per_page.should == 555 | ||
| 66 | + end | ||
| 56 | end | 67 | end |
| 57 | 68 | ||
| 58 | context "when the update is unsuccessful" do | 69 | context "when the update is unsuccessful" do |