Skip to content

Commit

Permalink
Changed customer role name to client to reflect frontend change and s…
Browse files Browse the repository at this point in the history
…ubsequent bug
  • Loading branch information
Steve committed May 25, 2011
1 parent c76bfce commit b66b6c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Expand Up @@ -6,7 +6,7 @@ class ProjectsController < ApplicationController


def index def index
if current_user if current_user
if current_user.role == 'customer' if current_user.role == 'client'
@projects = Project.find(:all, @projects = Project.find(:all,
:select => "DISTINCT projects.name, projects.*", :select => "DISTINCT projects.name, projects.*",
:conditions => ["participations.user_id = ?", current_user.to_param], :conditions => ["participations.user_id = ?", current_user.to_param],
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -16,7 +16,7 @@


class User < ActiveRecord::Base class User < ActiveRecord::Base


ROLES = ["admin", "developer", "customer"] ROLES = ["admin", "developer", "client"]


include Authentication include Authentication
include Authentication::ByPassword include Authentication::ByPassword
Expand Down
2 changes: 1 addition & 1 deletion test/blueprints.rb
Expand Up @@ -25,7 +25,7 @@
User.blueprint do User.blueprint do
login login
email email
role { "customer" } role { "client" }
password { 'monkey' } password { 'monkey' }
password_confirmation { 'monkey' } password_confirmation { 'monkey' }
end end
Expand Down
8 changes: 4 additions & 4 deletions test/functional/projects_controller_test.rb
Expand Up @@ -7,7 +7,7 @@ class ProjectsControllerTest < ActionController::TestCase
setup do setup do
@project = Project.make @project = Project.make
@admin = User.make(:admin) @admin = User.make(:admin)
@customer = User.make(:role => 'customer') @client = User.make(:role => 'client')
login_as(@admin) login_as(@admin)
end end


Expand All @@ -29,7 +29,7 @@ class ProjectsControllerTest < ActionController::TestCase


context 'GET to index as a non-participating user' do context 'GET to index as a non-participating user' do
setup do setup do
login_as(@customer) login_as(@client)
get :index get :index
end end
should "not show projects where the current user is not a participant" do should "not show projects where the current user is not a participant" do
Expand All @@ -41,10 +41,10 @@ class ProjectsControllerTest < ActionController::TestCase
setup do setup do
3.times do 3.times do
iteration = Iteration.make iteration = Iteration.make
iteration.geeks << @customer iteration.geeks << @client
@project.iterations << iteration @project.iterations << iteration
end end
login_as(@customer) login_as(@client)
get :index get :index
end end
should "not show projects where the current user is not a participant" do should "not show projects where the current user is not a participant" do
Expand Down
6 changes: 3 additions & 3 deletions test/unit/user_test.rb
Expand Up @@ -9,7 +9,7 @@ class UserTest < ActiveSupport::TestCase
context "the User class" do context "the User class" do


should "have a ROLES array in a constant" do should "have a ROLES array in a constant" do
assert_equal(["admin", "developer", "customer"], User::ROLES) assert_equal(["admin", "developer", "client"], User::ROLES)
end end




Expand Down Expand Up @@ -213,8 +213,8 @@ class UserTest < ActiveSupport::TestCase
@quentin = User.make(:quentin) @quentin = User.make(:quentin)
end end


should "have the role 'customer'" do should "have the role 'client'" do
assert @quentin.has_role?("customer") assert @quentin.has_role?("client")
end end


context "when setting the user's role" do context "when setting the user's role" do
Expand Down

0 comments on commit b66b6c3

Please sign in to comment.