Commit 1a5ed9eb authored by azul's avatar azul

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
--------------------------
......
......@@ -82,7 +82,7 @@ class Pages::ParticipationsController < Pages::SidebarsController
# watching group participations.
def fetch_data
return unless params[:access] && params[:id]
if params[:group]
if params[:group] && params[:group]!= 'false'
@part = @page.group_participations.find(params[:id])
else
@part = @page.user_participations.find(params[:id])
......
......@@ -71,7 +71,9 @@ class TasksController < Pages::BaseController
end
def task_params
params.require(:task).permit(:name, :description, :user_ids => [])
params.require(:task).
reverse_merge(user_ids: []).
permit(:name, :description, :user_ids => [])
end
def sort_params
......
......@@ -3,14 +3,15 @@ require 'test_helper'
class TasksControllerTest < ActionController::TestCase
fixtures :pages, :users, :task_lists, :tasks
def test_sort
login_as :blue
def setup
@user = users(:blue)
@page = pages(:tasklist1)
@page.add(@user, access: :admin)
@page.save!
login_as @user
end
def test_sort
assert_equal 1, Task.find(1).position
assert_equal 2, Task.find(2).position
assert_equal 3, Task.find(3).position
......@@ -24,11 +25,19 @@ class TasksControllerTest < ActionController::TestCase
end
def test_create_task
login_as :blue
pages(:tasklist1).add(users(:blue), access: :admin)
pages(:tasklist1).save!
assert_difference 'pages(:tasklist1).data.tasks.count' do
xhr :post, :create, page_id: pages(:tasklist1).id, task: {name: "new task", user_ids: ["5"], description: "new task description"}
assert_difference '@page.data.tasks.count' do
xhr :post, :create, page_id: @page.id,
task: {name: "new task", user_ids: ["5"], description: "new task description"}
end
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
......@@ -29,7 +29,14 @@ class TaskListTest < JavascriptIntegrationTest
assign_task_to users(:red)
assert_task_assigned_to users(:red)
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
def add_task(options = {})
......@@ -44,7 +51,9 @@ class TaskListTest < JavascriptIntegrationTest
def unassign_task_from(user)
edit_task
uncheck user.login
within '#sort_list_pending' do
uncheck user.login
end
click_on 'Save'
end
......@@ -94,7 +103,7 @@ class TaskListTest < JavascriptIntegrationTest
end
end
def assert_task_not_assigned_to(*users)
def assert_no_task_assigned_to(*users)
users.each do |user|
assert_no_selector '.people',
text: user.display_name
......
......@@ -66,7 +66,11 @@ module PageActions
click_on 'Page Details'
find('a', text: 'Permissions').click
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
wait_for_ajax # reload sidebar
end
......@@ -74,12 +78,14 @@ module PageActions
def delete_page(page = @page)
click_on 'Delete Page'
click_button 'Delete'
wait_for_ajax
# ensure after_commit callbacks are triggered so sphinx indexes the page.
page.page_terms.committed!
end
def undelete_page(page = @page)
click_on 'Undelete'
wait_for_ajax
# ensure after_commit callbacks are triggered so sphinx indexes the page.
page.page_terms.committed!
end
......
......@@ -2,6 +2,11 @@ require 'integration_test'
class ImageTest < IntegrationTest
def setup
FileUtils.mkdir_p(ASSET_PRIVATE_STORAGE)
FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE)
end
def test_get_asset
asset = FactoryGirl.create :image_asset
visit asset.url
......
......@@ -57,6 +57,15 @@ class PageSidebarTest < JavascriptIntegrationTest
assert_page_starred
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
path = current_path
delete_page
......
......@@ -14,11 +14,6 @@ class ProfileTest < ActiveSupport::TestCase
FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE)
end
def teardown
FileUtils.rm_rf(ASSET_PRIVATE_STORAGE)
FileUtils.rm_rf(ASSET_PUBLIC_STORAGE)
end
def test_adding_profile
u = users(:blue)
p = u.profiles.create stranger: true, first_name: 'Blue'
......
require_relative 'test_helper'
class TaskTest < ActiveSupport::TestCase
def setup
end
fixtures :users
def test_creation
assert list = TaskList.create
......@@ -45,4 +43,13 @@ class TaskTest < ActiveSupport::TestCase
assert_nil t.completed_at
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
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