Commit 1a5ed9eb authored by azul's avatar azul
Browse files

Merge pull request #309 from azul/release/0.6.2

Release/0.6.2
parents 277c8cf3 adaf1f4a
Changes in Crabgrass 0.6.2
--------------------------
Another bugfix release. This one has seen some serious speed improvements in
particular for updates that update a page.
The main user visible changes are the return of wiki diffs and stars for
comments. Also we sort group and user lists alphabetically in a number of
places now.
We also prepared the upgrade to rails 4 as much as possible. So we removed all
mods and turned the other rails 2.3 style plugins into engines that will be
compatible with rails4. We also moved all the activity tracking that was using
observers before into controllers. We now use helper classes to keep controllers
thin but trigger the action tracking from the controllers themselves.
Changes in Crabgrass 0.6.1 Changes in Crabgrass 0.6.1
-------------------------- --------------------------
......
...@@ -82,7 +82,7 @@ class Pages::ParticipationsController < Pages::SidebarsController ...@@ -82,7 +82,7 @@ class Pages::ParticipationsController < Pages::SidebarsController
# watching group participations. # watching group participations.
def fetch_data def fetch_data
return unless params[:access] && params[:id] return unless params[:access] && params[:id]
if params[:group] if params[:group] && params[:group]!= 'false'
@part = @page.group_participations.find(params[:id]) @part = @page.group_participations.find(params[:id])
else else
@part = @page.user_participations.find(params[:id]) @part = @page.user_participations.find(params[:id])
......
...@@ -71,7 +71,9 @@ class TasksController < Pages::BaseController ...@@ -71,7 +71,9 @@ class TasksController < Pages::BaseController
end end
def task_params def task_params
params.require(:task).permit(:name, :description, :user_ids => []) params.require(:task).
reverse_merge(user_ids: []).
permit(:name, :description, :user_ids => [])
end end
def sort_params def sort_params
......
...@@ -3,14 +3,15 @@ require 'test_helper' ...@@ -3,14 +3,15 @@ require 'test_helper'
class TasksControllerTest < ActionController::TestCase class TasksControllerTest < ActionController::TestCase
fixtures :pages, :users, :task_lists, :tasks fixtures :pages, :users, :task_lists, :tasks
def test_sort def setup
login_as :blue
@user = users(:blue) @user = users(:blue)
@page = pages(:tasklist1) @page = pages(:tasklist1)
@page.add(@user, access: :admin) @page.add(@user, access: :admin)
@page.save! @page.save!
login_as @user
end
def test_sort
assert_equal 1, Task.find(1).position assert_equal 1, Task.find(1).position
assert_equal 2, Task.find(2).position assert_equal 2, Task.find(2).position
assert_equal 3, Task.find(3).position assert_equal 3, Task.find(3).position
...@@ -24,11 +25,19 @@ class TasksControllerTest < ActionController::TestCase ...@@ -24,11 +25,19 @@ class TasksControllerTest < ActionController::TestCase
end end
def test_create_task def test_create_task
login_as :blue assert_difference '@page.data.tasks.count' do
pages(:tasklist1).add(users(:blue), access: :admin) xhr :post, :create, page_id: @page.id,
pages(:tasklist1).save! task: {name: "new task", user_ids: ["5"], description: "new task description"}
assert_difference 'pages(:tasklist1).data.tasks.count' do end
xhr :post, :create, page_id: pages(:tasklist1).id, task: {name: "new task", user_ids: ["5"], description: "new task description"} end
def test_update_task
list = @page.data
task = list.tasks.create name: 'blue... do something!',
user_ids: [@user.id]
assert_difference '@user.tasks.count', -1 do
xhr :put, :update, page_id: @page, id: task.id,
task: {name: "updated task", description: "new task description"}
end end
end end
end end
...@@ -29,7 +29,14 @@ class TaskListTest < JavascriptIntegrationTest ...@@ -29,7 +29,14 @@ class TaskListTest < JavascriptIntegrationTest
assign_task_to users(:red) assign_task_to users(:red)
assert_task_assigned_to users(:red) assert_task_assigned_to users(:red)
unassign_task_from user unassign_task_from user
assert_task_not_assigned_to users(:blue) assert_no_task_assigned_to users(:blue)
end
def test_unassigning_task_from_last_user
add_task
unassign_task_from user
assert_tasks_pending
assert_no_task_assigned_to(user)
end end
def add_task(options = {}) def add_task(options = {})
...@@ -44,7 +51,9 @@ class TaskListTest < JavascriptIntegrationTest ...@@ -44,7 +51,9 @@ class TaskListTest < JavascriptIntegrationTest
def unassign_task_from(user) def unassign_task_from(user)
edit_task edit_task
uncheck user.login within '#sort_list_pending' do
uncheck user.login
end
click_on 'Save' click_on 'Save'
end end
...@@ -94,7 +103,7 @@ class TaskListTest < JavascriptIntegrationTest ...@@ -94,7 +103,7 @@ class TaskListTest < JavascriptIntegrationTest
end end
end end
def assert_task_not_assigned_to(*users) def assert_no_task_assigned_to(*users)
users.each do |user| users.each do |user|
assert_no_selector '.people', assert_no_selector '.people',
text: user.display_name text: user.display_name
......
...@@ -66,7 +66,11 @@ module PageActions ...@@ -66,7 +66,11 @@ module PageActions
click_on 'Page Details' click_on 'Page Details'
find('a', text: 'Permissions').click find('a', text: 'Permissions').click
select permission select permission
assert_selector "#permissions_tab .tiny_#{PERMISSION_ICONS[permission]}_16" if PERMISSION_ICONS.keys.include? permission
assert_selector "#permissions_tab .tiny_#{PERMISSION_ICONS[permission]}_16"
else
wait_for_ajax
end
close_popup close_popup
wait_for_ajax # reload sidebar wait_for_ajax # reload sidebar
end end
...@@ -74,12 +78,14 @@ module PageActions ...@@ -74,12 +78,14 @@ module PageActions
def delete_page(page = @page) def delete_page(page = @page)
click_on 'Delete Page' click_on 'Delete Page'
click_button 'Delete' click_button 'Delete'
wait_for_ajax
# ensure after_commit callbacks are triggered so sphinx indexes the page. # ensure after_commit callbacks are triggered so sphinx indexes the page.
page.page_terms.committed! page.page_terms.committed!
end end
def undelete_page(page = @page) def undelete_page(page = @page)
click_on 'Undelete' click_on 'Undelete'
wait_for_ajax
# ensure after_commit callbacks are triggered so sphinx indexes the page. # ensure after_commit callbacks are triggered so sphinx indexes the page.
page.page_terms.committed! page.page_terms.committed!
end end
......
...@@ -2,6 +2,11 @@ require 'integration_test' ...@@ -2,6 +2,11 @@ require 'integration_test'
class ImageTest < IntegrationTest class ImageTest < IntegrationTest
def setup
FileUtils.mkdir_p(ASSET_PRIVATE_STORAGE)
FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE)
end
def test_get_asset def test_get_asset
asset = FactoryGirl.create :image_asset asset = FactoryGirl.create :image_asset
visit asset.url visit asset.url
......
...@@ -57,6 +57,15 @@ class PageSidebarTest < JavascriptIntegrationTest ...@@ -57,6 +57,15 @@ class PageSidebarTest < JavascriptIntegrationTest
assert_page_starred assert_page_starred
end end
def test_remove_user_from_page
@page.add(users(:red), access: :admin)
@page.save!
visit current_url # reload
assert_page_users users(:blue), users(:red)
change_access_to 'No Access'
assert_page_users users(:blue)
end
def test_trash def test_trash
path = current_path path = current_path
delete_page delete_page
......
...@@ -14,11 +14,6 @@ class ProfileTest < ActiveSupport::TestCase ...@@ -14,11 +14,6 @@ class ProfileTest < ActiveSupport::TestCase
FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE) FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE)
end end
def teardown
FileUtils.rm_rf(ASSET_PRIVATE_STORAGE)
FileUtils.rm_rf(ASSET_PUBLIC_STORAGE)
end
def test_adding_profile def test_adding_profile
u = users(:blue) u = users(:blue)
p = u.profiles.create stranger: true, first_name: 'Blue' p = u.profiles.create stranger: true, first_name: 'Blue'
......
require_relative 'test_helper' require_relative 'test_helper'
class TaskTest < ActiveSupport::TestCase class TaskTest < ActiveSupport::TestCase
fixtures :users
def setup
end
def test_creation def test_creation
assert list = TaskList.create assert list = TaskList.create
...@@ -45,4 +43,13 @@ class TaskTest < ActiveSupport::TestCase ...@@ -45,4 +43,13 @@ class TaskTest < ActiveSupport::TestCase
assert_nil t.completed_at assert_nil t.completed_at
end end
def test_unassigning_from_last_user
list = TaskList.create
task = list.tasks.create
task.user_ids = [users(:blue).id]
task.save
task.user_ids = []
task.save
assert_equal [], task.user_ids
end
end end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment