[PATCH] Adds team leads to sprints. #99
by Darryl L. Pierce
This patch requires a migration. It adds the "team_lead_id" column to
the sprints table. Unit tests have been modified to test for the
existence of the team lead.
On the sprint edit screen the product owner is able to select a product
team member to be the lead for the sprint. On the sprint list page there
is now a link to send the team lead an email.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/models/sprint.rb | 9 ++++++-
app/views/sprints/_edit.html.erb | 9 ++++++
app/views/sprints/_list.html.erb | 7 +++-
app/views/sprints/show.html.erb | 5 +++
db/migrate/027_add_team_lead_to_sprint.rb | 38 ++++++++++++++++++++++++++++
test/fixtures/sprints.yml | 3 ++
test/functional/sprints_controller_test.rb | 9 +++---
test/unit/sprint_test.rb | 22 +++++++++++-----
8 files changed, 88 insertions(+), 14 deletions(-)
create mode 100644 db/migrate/027_add_team_lead_to_sprint.rb
diff --git a/app/models/sprint.rb b/app/models/sprint.rb
index cb009b1..cd99d4d 100644
--- a/app/models/sprint.rb
+++ b/app/models/sprint.rb
@@ -56,9 +56,13 @@ class Sprint < ActiveRecord::Base
validates_presence_of :goals,
:message => 'Please list the goals for this sprint.'
+ validates_presence_of :team_lead_id,
+ :message => 'A sprint must have a designated team lead.'
+
after_update :close_user_stories
belongs_to :product
+ belongs_to :team_lead, :class_name => 'User', :foreign_key => :team_lead_id
has_many :backlog_items,
:order => '(select priority from user_stories where id = user_story_id) ASC',
@@ -128,7 +132,10 @@ class Sprint < ActiveRecord::Base
# Returns whether the specified user is allowed to populate this sprint.
def can_populate?(user)
- user && (user.id == product.owner.id) && pending?
+ user &&
+ ((user.id == product.owner.id) ||
+ (user.id == sprint.team_lead_id)) &&
+ pending?
end
# Returns whether the sprint can be moved to the given status.
diff --git a/app/views/sprints/_edit.html.erb b/app/views/sprints/_edit.html.erb
index c6cfaf0..9fca540 100644
--- a/app/views/sprints/_edit.html.erb
+++ b/app/views/sprints/_edit.html.erb
@@ -21,6 +21,15 @@
</td>
</tr>
+ <tr>
+ <td class="label-required">Team lead</td>
+ <td class="value">
+ <%= collection_select :sprint, :team_lead_id, @product.users, :id,
+ :display_name, {:include_blank => false} %>
+ <%= error_message_on (:sprint, :team_lead_id) %>
+ </td>
+ </tr>
+
<tr>
<td class="label-required">Starts on</td>
<td class="value">
diff --git a/app/views/sprints/_list.html.erb b/app/views/sprints/_list.html.erb
index f549b09..4d6f956 100644
--- a/app/views/sprints/_list.html.erb
+++ b/app/views/sprints/_list.html.erb
@@ -1,6 +1,7 @@
<table class="list">
<colgroup>
<col class="row_id" />
+ <col class="name" />
<col class="description" />
<col class="status" />
<col class="date" />
@@ -11,9 +12,10 @@
<thead>
<tr>
- <th class="title" colspan="7">Sprints</th>
+ <th class="title" colspan="8">Sprints</th>
<tr>
<th>#</th>
+ <th>Team Lead</th>
<th>Title</th>
<th>Status</th>
<th>Starts</th>
@@ -26,13 +28,14 @@
<tbody>
<% if @sprints.empty? %>
<tr>
- <td colspan="7">No sprints found...</td>
+ <td colspan="8">No sprints found...</td>
</tr>
<% else %>
<% @sprints.each_with_index do |sprint, index| %>
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
<td><%= "#{sprint.id}" %></td>
+ <td><%= mail_to sprint.team_lead.email, sprint.team_lead.display_name %></td>
<td><%= sprint.title %></td>
<td><%= sprint.status_text %></td>
<td><%= show_date(sprint.start) %></td>
diff --git a/app/views/sprints/show.html.erb b/app/views/sprints/show.html.erb
index 2368d6d..a5a3264 100644
--- a/app/views/sprints/show.html.erb
+++ b/app/views/sprints/show.html.erb
@@ -33,6 +33,11 @@
</tr>
<tr>
+ <td class="label">Team lead:</td>
+ <td class="value"><%= mail_to @sprint.team_lead.email, @sprint.team_lead.display_name %></td>
+ </tr>
+
+ <tr>
<td class="label">Starts:</td>
<td class="value"><%= show_date((a)sprint.start) %></td>
</tr>
diff --git a/db/migrate/027_add_team_lead_to_sprint.rb b/db/migrate/027_add_team_lead_to_sprint.rb
new file mode 100644
index 0000000..e90fea9
--- /dev/null
+++ b/db/migrate/027_add_team_lead_to_sprint.rb
@@ -0,0 +1,38 @@
+# 02y_add_team_lead_to_sprint.rb
+# Copyright (C) 2009, Darryl L. Pierce <mcpierce(a)gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+class AddTeamLeadToSprint < ActiveRecord::Migration
+ def self.up
+ Sprint.transaction do
+ add_column :sprints, :team_lead_id, :integer
+
+ Sprint.find(:all).each do |sprint|
+ sprint.team_lead_id = sprint.product.owner_id
+ sprint.save
+ end
+
+ change_column :sprints, :team_lead_id, :integer, :null => false
+
+ execute 'alter table sprints add constraint fk_sprint_team_lead
+ foreign key (team_lead_id) references users(id)'
+ end
+ end
+
+ def self.down
+ remove_column :sprints, :team_lead_id
+ end
+end
diff --git a/test/fixtures/sprints.yml b/test/fixtures/sprints.yml
index 170ba19..704c0c0 100644
--- a/test/fixtures/sprints.yml
+++ b/test/fixtures/sprints.yml
@@ -5,6 +5,7 @@ active_sprint:
duration: 28
goals: Get things done.
status: <%= Sprint::STATUS_ACTIVE %>
+ team_lead_id: <%= Fixtures.identify(:projxp_owner) %>
inactive_sprint:
product_id: <%= Fixtures.identify(:projxp_web) %>
@@ -13,6 +14,7 @@ inactive_sprint:
duration: 28
goals: Got stuff done.
status: <%= Sprint::STATUS_PLANNED %>
+ team_lead_id: <%= Fixtures.identify(:projxp_owner) %>
closed_sprint:
product_id: <%= Fixtures.identify(:projxp_web) %>
@@ -21,3 +23,4 @@ closed_sprint:
duration: 28
goals: Get more stuff done.
status: <%= Sprint::STATUS_CLOSED %>
+ team_lead_id: <%= Fixtures.identify(:projxp_owner) %>
diff --git a/test/functional/sprints_controller_test.rb b/test/functional/sprints_controller_test.rb
index 2432972..f39094a 100644
--- a/test/functional/sprints_controller_test.rb
+++ b/test/functional/sprints_controller_test.rb
@@ -39,10 +39,11 @@ class SprintsControllerTest < ActionController::TestCase
raise "Nonowner and owner must be different people!" if @owner.id == @nonowner.id
@new_sprint = {
- :title => "New Sprint",
- :start => Date.today,
- :duration => 28,
- :goals => "Get lots of things done!"
+ :title => "New Sprint",
+ :start => Date.today,
+ :duration => 28,
+ :goals => "Get lots of things done!",
+ :team_lead_id => @owner.id
}
@user_story = user_stories(:create_user_story_web_service_api)
diff --git a/test/unit/sprint_test.rb b/test/unit/sprint_test.rb
index d7c2fa6..fa8e5b5 100644
--- a/test/unit/sprint_test.rb
+++ b/test/unit/sprint_test.rb
@@ -24,12 +24,12 @@ class SprintTest < ActiveSupport::TestCase
def setup
@product = products(:projxp_web)
- @new_sprint = Sprint.new(
- :product_id => @product.id,
- :title => 'Sprint1',
- :start => Date.today - 7,
- :duration => 14,
- :goals => "Things I'd like to accomplish.")
+ @new_sprint = Sprint.new(:product_id => @product.id,
+ :title => 'Sprint1',
+ :start => Date.today- - 7,
+ :duration => 14,
+ :goals => "Things I'd like to accomplish.",
+ :team_lead_id => @product.owner.id)
@developer = users(:mcpierce)
raise "Developer is not a member of the product team." unless @product.is_member?(@developer)
@@ -84,6 +84,13 @@ class SprintTest < ActiveSupport::TestCase
flunk 'A sprint must have goals.' if @new_sprint.valid?
end
+ # Ensures that a sprint must have a team lead.
+ def test_valid_fails_without_team_lead
+ @new_sprint.team_lead_id = nil
+
+ flunk 'A sprint must have a team lead.' if @new_sprint.valid?
+ end
+
# Ensures that an unhealthy sprint returns the appropriate value.
def test_health_for_unhealthy_sprint
@new_sprint.backlog_items = @unhealthy_backlog
@@ -123,6 +130,7 @@ class SprintTest < ActiveSupport::TestCase
def test_end_date
# the sprint was set at 14 days, starting 7 days ago, so the end date should
# be 6 days from now
- assert_equal Date.today + 6, @new_sprint.end_date, "End date calculation is wrong."
+ assert_equal @new_sprint.start + (@new_sprint.duration - 1), @new_sprint.end_date,
+ "End date calculation is wrong."
end
end
--
1.6.0.6
15 years, 2 months
[PATCH] The home page content can be edited through the home page administration page. #96
by LAN-SUN-LUK Benjamin
Signed-off-by: Benjamin LAN-SUN-LUK <benjamin.lan-sun-luk(a)supinfo.com>
---
app/controllers/emails_controller.rb | 2 +-
app/controllers/home_contents_controller.rb | 22 ++++++++++++++++++++++
app/views/admin/index.html.erb | 1 +
app/views/emails/edit.html.erb | 2 +-
app/views/home_contents/edit.html.erb | 8 ++++++++
config/routes.rb | 1 +
test/functional/home_content_controller_test.rb | 8 ++++++++
7 files changed, 42 insertions(+), 2 deletions(-)
create mode 100644 app/controllers/home_contents_controller.rb
create mode 100644 app/views/home_contents/edit.html.erb
create mode 100644 test/functional/home_content_controller_test.rb
diff --git a/app/controllers/emails_controller.rb b/app/controllers/emails_controller.rb
index 13afd87..c9b1fdf 100644
--- a/app/controllers/emails_controller.rb
+++ b/app/controllers/emails_controller.rb
@@ -1,4 +1,4 @@
-# emails_controller.rb
+# emails_controller.rb
# Copyright (C) 2008, Darryl L. Pierce <mcpierce(a)gmail.com>
#
# This program is free software: you can redistribute it and/or modify it under
diff --git a/app/controllers/home_contents_controller.rb b/app/controllers/home_contents_controller.rb
new file mode 100644
index 0000000..3a1fe0e
--- /dev/null
+++ b/app/controllers/home_contents_controller.rb
@@ -0,0 +1,22 @@
+# home_contents_controller.rb
+
+# Allow an admin to edit the content of the homepage
+class HomeContentsController < ApplicationController
+ def show
+ redirect_to :action => 'edit'
+ end
+
+ def edit
+ @content = ConfigProperty.fetch('text.homepage')
+ end
+
+ def update
+ if ConfigProperty.store('text.homepage', params['content'])
+ flash[:notice] = "Home page content updated"
+ end
+
+ respond_to do |format|
+ format.html { redirect_to :action => 'edit' }
+ end
+ end
+end
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
index 7fbfdae..8fa22f8 100644
--- a/app/views/admin/index.html.erb
+++ b/app/views/admin/index.html.erb
@@ -1,3 +1,4 @@
<ul class="menulist">
<li class="menulist-item"><%= link_to "Configure Email", admin_email_url %></li>
+ <li class="menulist-item"><%= link_to "Home page content", admin_home_content_url %></li>
</ul>
diff --git a/app/views/emails/edit.html.erb b/app/views/emails/edit.html.erb
index 231127a..2eca356 100644
--- a/app/views/emails/edit.html.erb
+++ b/app/views/emails/edit.html.erb
@@ -1,4 +1,4 @@
-s<fieldset id="email-config">
+<fieldset id="email-config">
<legend>Email Configuration</legend>
<% form_tag admin_email_path, :method => :put do %>
<table class="edit">
diff --git a/app/views/home_contents/edit.html.erb b/app/views/home_contents/edit.html.erb
new file mode 100644
index 0000000..5140dd3
--- /dev/null
+++ b/app/views/home_contents/edit.html.erb
@@ -0,0 +1,8 @@
+<fieldset id="home-content-config">
+ <legend>Home page content</legend>
+ <p style="color: green;"><%= flash[:notice] %></p>
+ <%= form_tag admin_home_content_path, :method => :put %>
+ <textarea cols="128" rows="32" name="content"><%= @content %></textarea>
+ <%= submit_tag 'Save' %>
+ </form>
+</fieldset>
diff --git a/config/routes.rb b/config/routes.rb
index 6bf6212..ba069c8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,6 +20,7 @@ ActionController::Routing::Routes.draw do |map|
map.resource :admin do |admin|
admin.resource :email
+ admin.resource :home_content
end
map.resources :projects
diff --git a/test/functional/home_content_controller_test.rb b/test/functional/home_content_controller_test.rb
new file mode 100644
index 0000000..14be19d
--- /dev/null
+++ b/test/functional/home_content_controller_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class HomeContentControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ def test_truth
+ assert true
+ end
+end
--
1.5.6.3
15 years, 2 months
[PATCH] The home page content comes from the site content database. #95
by LAN-SUN-LUK Benjamin
Signed-off-by: Benjamin LAN-SUN-LUK <benjamin.lan-sun-luk(a)supinfo.com>
---
app/controllers/home_controller.rb | 6 +++++-
app/views/home/index.html.erb | 3 +--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 15d708c..6666871 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -28,7 +28,11 @@ class HomeController < ApplicationController
:except => [:index, :error, :login, :register, :generate_new_password]
def index
-
+ @content = ConfigProperty.fetch('home_page')
+ if @content.nil?
+ ConfigProperty.store('home_page', "<h1>Welcome To Another Installation Of ProjXP!</h1>")
+ @content = ConfigProperty.fetch('home_page')
+ end
end
def error
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index e9aeb91..110ab83 100644
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -1,2 +1 @@
-<h1>Welcome To Another Installation Of ProjXP!</h1>
-
+<%= @content %>
--
1.5.6.3
15 years, 2 months
[PATCH] Users can request projects. #97
by Darryl L. Pierce
You will need to perform a migration for this patch.
The projects table now has a column, called "approved", that
specifies whether the project has been approved or not. If not
approved then no products can be created and the project is only
visible to the owner and a user with project admin rights.
If a regular user requests a project be created, the project
record is created and marked as not approved. An email is sent to
the admin user with a link back to the new project.
If a user with project create rights creates a project, it's
automatically approved.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/controllers/projects_controller.rb | 40 +++++++++++--------------
app/views/projects/_edit.html.erb | 12 +------
app/views/projects/index.html.erb | 7 +++-
app/views/projects/show.html.erb | 1 +
db/migrate/026_users_request_new_projects.rb | 33 +++++++++++++++++++++
test/functional/projects_controller_test.rb | 34 +++++++++++++---------
6 files changed, 79 insertions(+), 48 deletions(-)
create mode 100644 db/migrate/026_users_request_new_projects.rb
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 50329cb..f8aa305 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -45,7 +45,7 @@ class ProjectsController < ApplicationController
# GET /projects/new
def new
- if @user.can_create_projects?
+ if @user
@title = "New Project"
@project = Project.new(:owner_id => @user.id)
@source = params[:source] if params[:source]
@@ -69,27 +69,19 @@ class ProjectsController < ApplicationController
# POST /projects
def create
respond_to do |format|
- if @user.can_create_projects?
- @project = Project.new(params[:project])
-
- begin
- Project.transaction do
- if @project.save
- flash[:message] = "Project '#{(a)project.name}' created!"
- format.html { redirect_to params[:source] ? params[:source] : project_url(@project) }
- else
- @title = "New Project"
- @project.valid?
- format.html { render :action => "new" }
- end
- end
- rescue Exception => error
- flash[:error] = "ERROR: #{error.message}"
- format.html { redirect_to params[:source] ? params[:source] : error_url }
+ @project = Project.new(params[:project])
+ # if the project is being created by an admin, then mark it approved
+ @project.approved = @user.can_create_projects?
+
+ Project.transaction do
+ if @project.save
+ flash[:message] = "Project '#{(a)project.name}' created!"
+ format.html { redirect_to params[:source] ? params[:source] : project_url(@project) }
+ else
+ @title = "New Project"
+ @project.valid?
+ format.html { render :action => "new" }
end
- else
- flash[:error] = "You are not authorized to create projects."
- format.html { redirect_to params[:source] ? params[:source] : error_url }
end
end
end
@@ -145,6 +137,10 @@ class ProjectsController < ApplicationController
end
def setup_for_edit
- @users = User.find(:all, :order => 'display_name ASC')
+ if @user.can_create_projects?
+ @users = User.find(:all, :order => 'display_name ASC')
+ else
+ @users = [@user]
+ end
end
end
diff --git a/app/views/projects/_edit.html.erb b/app/views/projects/_edit.html.erb
index 153493f..72bd335 100644
--- a/app/views/projects/_edit.html.erb
+++ b/app/views/projects/_edit.html.erb
@@ -33,16 +33,8 @@
<tr>
<td class="label-required">Owner</td>
<td class="value">
- <% if @user.privileges.admin_projects %>
- <%= collection_select :project, :owner_id, @users, :id,
- :display_name, {:include_blank => true} %>
- <% else %>
- <% if @project.owner %>
- <%= h @project.owner.display_name %>
- <% else %>
- UNOWNED
- <% end %>
- <% end %>
+ <%= collection_select :project, :owner_id, @users, :id,
+ :display_name, {:include_blank => false} %>
<%= error_message_on(:project, :owner) %>
</td>
</tr>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index 824c010..d6b5447 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -8,7 +8,7 @@
<tr>
<td class="toolbar" colspan="2">
<%= link_to(image_tag("icons/new.png", :title => "Create a new project..."),
- new_project_path) if @user && @user.can_create_projects? %>
+ new_project_path) if @user %>
</td>
</tr>
</tbody>
@@ -48,7 +48,10 @@
<tr class="<%= row_class %>">
<td class="row_id"><%= "#{project.id}" %></td>
- <td><%= project.name %></td>
+ <td>
+ <%= project.name %>
+ <%= project.approved ? "" : " (Pending)" %>
+ </td>
<td><%= get_first_sentence project.description %></td>
<td><%= link_to project.owner.display_name, user_path(project.owner) %></td>
<td><%= show_date(project.created_at) %></td>
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index 504bf11..8d93f4c 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -13,6 +13,7 @@
<tbody>
<tr>
<td class="toolbar" colspan="2">
+ <%= link_to(image_tag("icons/add.png", :title => "Request a new project..."), new_project_path) if @user %>
<%= link_to(image_tag("icons/back.png", :title => "Back..."),
projects_path) %>
<%= link_to(image_tag("icons/edit.png", :title => "Edit this project..."),
diff --git a/db/migrate/026_users_request_new_projects.rb b/db/migrate/026_users_request_new_projects.rb
new file mode 100644
index 0000000..e989101
--- /dev/null
+++ b/db/migrate/026_users_request_new_projects.rb
@@ -0,0 +1,33 @@
+# 026_users_request_new_projects.rb
+# Copyright (C) 2009, Darryl L. Pierce <mcpierce(a)gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+class UsersRequestNewProjects < ActiveRecord::Migration
+ def self.up
+ Project.transaction do
+ add_column :projects, :approved, :boolean, :null => false, :default => false
+
+ Project.find(:all).each do |project|
+ project.approved = true
+ project.save
+ end
+ end
+ end
+
+ def self.down
+ remove_column :projects, :approved
+ end
+end
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 9a3fae0..f46ef34 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -35,6 +35,7 @@ class ProjectsControllerTest < ActionController::TestCase
@admin = users(:admin)
raise "Nonadmin and admin cannot be the same user!" if @nonadmin.id == @admin.id
+ raise "Admin must have project admin rights!" unless @admin.can_create_projects?
end
# Ensures that showing the project index works as expected.
@@ -81,13 +82,15 @@ class ProjectsControllerTest < ActionController::TestCase
assert_redirected_to :controller => :home, :action => :login
end
- # Ensures that a user without project admin privileges cannot create a
- # project.
+ # Ensures that a user without project admin privileges can
+ # create a project but that it is not approved.
#
- def test_new_as_unauthorized_user
+ def test_new_as_nonadmin
get :new, {}, {:user_id => @nonadmin.id}
- assert_redirected_to error_url
+ assert_response :success
+ assert_equal 1, assigns['users'].size,
+ "The only owner a non-admin can assign is himself!"
end
# Ensures that starting off a new project works as expected.
@@ -96,11 +99,6 @@ class ProjectsControllerTest < ActionController::TestCase
get :new, {}, {:user_id => @admin.id}
assert_response :success
- assert assigns['project'], "Did not create a new project."
- assert_equal @admin.id, assigns['project'].owner_id,
- "Did not assign the default owner."
- assert assigns['users'], "Did not load the list of users."
- assert !assigns['source'], "Should not have stored a URL."
end
# Ensures that the url is held.
@@ -182,12 +180,17 @@ class ProjectsControllerTest < ActionController::TestCase
assert_redirected_to login_url
end
- # Ensures that a non-admin cannot create a project.
+ # Ensures that a non-admin can create an unapproved project.
#
def test_create_as_nonadmin
- post :create, {}, {:user_id => @nonadmin.id}
+ post :create,
+ {:project => {:name => 'test', :owner_id => @admin.id}},
+ {:user_id => @nonadmin.id}
- assert_redirected_to error_url
+ result = Project.find_by_name('test')
+ assert_redirected_to project_url(result)
+ assert result, "Project was not created!"
+ assert !result.approved, "Project should not have been approved!"
end
# Ensures that an invalid project returns the user to the edit page.
@@ -207,14 +210,17 @@ class ProjectsControllerTest < ActionController::TestCase
{:project => {:name => 'test', :owner_id => @admin.id}},
{:user_id => @admin.id}
- assert_redirected_to project_path(assigns['project'])
+ result = Project.find_by_name('test')
+ assert_redirected_to project_url(result)
+ assert result, "Project was not created!"
+ assert result.approved, "Project should have been approved!"
end
# Ensures the user is returned to the origin page if a url was provided.
#
def test_create_with_url
post :create,
- {:project => {:name => 'test', :owner_id => @admin.id},
+ {:project => {:name => 'test', :owner_id => @admin.id},
:source => "/farkle"},
{:user_id => @admin.id}
--
1.6.0.2
15 years, 2 months