diff --git a/app/views/my/blocks/_open_approvals.html.erb b/app/views/my/blocks/_open_approvals.html.erb index b801b633..58763291 100644 --- a/app/views/my/blocks/_open_approvals.html.erb +++ b/app/views/my/blocks/_open_approvals.html.erb @@ -1,7 +1,7 @@ <%# # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-14 Karel Picman +# Copyright (C) 2011-15 Karel Picman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,7 +23,8 @@ 'dmsf_workflow_step_assignments.user_id = ? AND dmsf_workflow_step_actions.id IS NULL', @user.id).all %> <% assignments = Array.new %> <% all_assignments.each do |assignment| %> - <% if !assignment.dmsf_file_revision.file.last_revision.deleted && + <% if assignment.dmsf_file_revision.file.last_revision && + !assignment.dmsf_file_revision.file.last_revision.deleted && (assignment.dmsf_file_revision.workflow == DmsfWorkflow::STATE_WAITING_FOR_APPROVAL) && (assignment.dmsf_file_revision == assignment.dmsf_file_revision.file.last_revision) %> <% assignments << assignment %> diff --git a/lib/redmine_dmsf/test/test_case.rb b/lib/redmine_dmsf/test/test_case.rb index 5c607577..b9024b13 100644 --- a/lib/redmine_dmsf/test/test_case.rb +++ b/lib/redmine_dmsf/test/test_case.rb @@ -1,8 +1,10 @@ +# encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-14 Karel Pičman +# Copyright (C) 2011-15 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -28,7 +30,7 @@ module RedmineDmsf def self.fixtures(*table_names) dir = File.join( File.dirname(__FILE__), '../../../test/fixtures') table_names.each do |x| - ActiveRecord::Fixtures.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml") + ActiveRecord::FixtureSet.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml") end super(table_names) end diff --git a/test/functional/dmsf_workflow_controller_test.rb b/test/functional/dmsf_workflow_controller_test.rb index bb149ec1..e919899a 100644 --- a/test/functional/dmsf_workflow_controller_test.rb +++ b/test/functional/dmsf_workflow_controller_test.rb @@ -155,10 +155,10 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_add_step assert_difference 'DmsfWorkflowStep.count', +1 do - post :add_step, :commit => l(:dmsf_or), :step => 1, :id => @wf1.id, :user_ids =>[@user_non_member.id] + post :add_step, :commit => l(:dmsf_or), :step => 1, :id => @wf1.id, :user_ids => [@user_non_member.id] end assert_response :success - ws = DmsfWorkflowStep.first(:order => 'id DESC') + ws = DmsfWorkflowStep.order('id DESC').first assert_equal @wf1.id, ws.dmsf_workflow_id assert_equal 1, ws.step assert_equal @user_non_member.id, ws.user_id @@ -171,7 +171,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase delete :remove_step, :step => @wfs1.id, :id => @wf1.id end assert_response :success - ws = DmsfWorkflowStep.where(:dmsf_workflow_id => @wf1.id).first(:order => 'id ASC') + ws = DmsfWorkflowStep.where(:dmsf_workflow_id => @wf1.id).order('id ASC').first assert_equal 1, ws.step end