upgrade last of the project functions

This commit is contained in:
Reinier Balt 2010-10-22 11:55:54 +02:00
parent 2c47b27a87
commit d7a780ef0c
8 changed files with 20 additions and 18 deletions

View file

@ -218,7 +218,7 @@ class ProjectsController < ApplicationController
def render_projects_html
lambda do
@page_title = t('projects.list_projects')
@count = current_user.projects.size
@count = current_user.projects.count
@active_projects = current_user.projects.active
@hidden_projects = current_user.projects.hidden
@completed_projects = current_user.projects.completed

View file

@ -2,11 +2,11 @@
<h2><span id="<%= state %>-projects-count" class="badge"><%= project_state_group.length %></span><%= t('states.'+state+'_plural' )%> <%= t('common.projects') %></h2>
<div class="menu_sort"><span class="sort_separator"><%= t('common.sort.sort') %>&nbsp;</span>
<div class="alpha_sort">
<%= link_to(t('common.sort.alphabetically'), alphabetize_projects_path(:state => state),
:class => "alphabetize_link", :title => t('common.sort.alphabetically_title')) %>
<%= link_to("Alphabetically", alphabetize_projects_path(:state => state),
:id => "#{state}_alphabetize_link", :class => "alphabetize_link", :title => t('common.sort.alphabetically_title')) %>
</div><span class="sort_separator">&nbsp;|&nbsp;</span><div class="tasks_sort">
<%= link_to(t('common.sort.by_task_count'), actionize_projects_path(:state => state),
:class => "actionize_link", :title => t('common.sort.by_task_count_title')) %>
<%= link_to("By number of tasks", actionize_projects_path(:state => state),
:id => "#{state}_actionize_link", :class => "actionize_link", :title => t('common.sort.by_task_count_title')) %>
</div>
</div>

View file

@ -19,7 +19,7 @@ Feature: Edit a project
And I should see the bold text "done" in the project description
# Ticket #1043
@selenium
@selenium, @wip
Scenario: I can move a todo out of the current project
Given I have a project "foo" with 2 todos
When I visit the "foo" project

View file

@ -79,17 +79,18 @@ Feature: Manage the list of projects
And I submit a new project with name "finish cucumber tests" and select take me to the project
Then I should be on the "finish cucumber tests" project page
@selenium, @wip
@selenium
Scenario: Sorting the project alphabetically
When I go to the projects page
Then the project "manage me" should be above the project "a project name starting with a"
When I sort the list alphabetically
When I sort the active list alphabetically
Then the project "a project name starting with a" should be above the project "manage me"
@selenium, @wip
@selenium
Scenario: Sorting the project by number of task
Given I have a project "test" with 2 todos
And I have a project "very busy" with 10 todos
When I go to the projects page
Then the project "manage me" should be above the project "test"
Then the project "test" should be above the project "very busy"
When I sort the list by number of tasks
Then the project "test" should be above the project "manage me"
Then the project "very busy" should be above the project "test"

View file

@ -1,5 +1,4 @@
When /^I delete project "([^"]*)"$/ do |project_name|
# from the project list page
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
click_link "delete_project_#{project.id}"
@ -38,10 +37,10 @@ When /^I submit a new project with name "([^"]*)" and select take me to the proj
selenium.wait_for_page_to_load(5000) # follow the redirect
end
When /^I sort the list alphabetically$/ do
When /^I sort the active list alphabetically$/ do
click_link "Alphabetically"
selenium.wait_for :wait_for => :ajax, :javascript_framework => :jquery
selenium.get_confirmation.should == "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order."
end
When /^I sort the list by number of tasks$/ do

View file

@ -1,5 +1,5 @@
Given /^I have a project "([^\"]*)" with (.*) todos$/ do |project_name, num_todos|
context = @current_user.contexts.create!(:name => "Context A")
context = @current_user.contexts.find_or_create_by_name("Context A")
project = @current_user.projects.create!(:name => project_name)
1.upto num_todos.to_i do |i|
@current_user.todos.create!(

View file

@ -73,7 +73,10 @@ Then /^I should see ([0-9]+) todos$/ do |count|
end
When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field, todo_name, new_value|
selenium.click("//span[@class=\"todo.descr\"][.=\"#{todo_name}\"]/../../a[@class=\"icon edit_item\"]", :wait_for => :ajax, :javascript_framework => :jquery)
todo = @current_user.todos.find_by_description(todo_name)
todo.should_not be_nil
selenium.click("//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
selenium.type("css=form.edit_todo_form input[name=#{field}]", new_value)
selenium.click("css=button.positive", :wait_for => :ajax, :javascript_framework => :jquery)
sleep(5)

View file

@ -6,14 +6,13 @@ if ENV["RAILS_ENV"] == "selenium"
config.application_environment = :selenium
# use only if you run a separate rails test server instance and do not
# want webrat to start one for you
config.application_port = 3001
# config.application_port = 3001
config.selenium_browser_startup_timeout = 30
# use only if you run a separate selenium server instance and do not
# want webrat to start one for you
config.selenium_server_address = "localhost"
# config.selenium_server_port = "4444"
end
Cucumber::Rails::World.use_transactional_fixtures = false