Commit 6ee23a50812205ecc3beab40ccb7f72ae423ac56
1 parent
c63abafb
Exists in
master
and in
29 other branches
work_assignment plugin: fix tests
the assumption on authorship changed from last_changed_by to created_by
Showing
2 changed files
with
6 additions
and
4 deletions
Show diff stats
plugins/work_assignment/test/unit/work_assingment_plugin/work_assignment_test.rb
@@ -35,7 +35,7 @@ class WorkAssignmentTest < ActiveSupport::TestCase | @@ -35,7 +35,7 @@ class WorkAssignmentTest < ActiveSupport::TestCase | ||
35 | organization = fast_create(Organization) | 35 | organization = fast_create(Organization) |
36 | author = fast_create(Person) | 36 | author = fast_create(Person) |
37 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Sample Work Assignment', :profile => organization) | 37 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Sample Work Assignment', :profile => organization) |
38 | - submission = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => work_assignment, :last_changed_by => author) | 38 | + submission = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => work_assignment, :created_by => author) |
39 | 39 | ||
40 | author_folder = work_assignment.find_or_create_author_folder(author) | 40 | author_folder = work_assignment.find_or_create_author_folder(author) |
41 | assert_equal author_folder, submission.parent | 41 | assert_equal author_folder, submission.parent |
plugins/work_assignment/test/unit/work_assingment_plugin_test.rb
@@ -3,7 +3,7 @@ require 'test_helper' | @@ -3,7 +3,7 @@ require 'test_helper' | ||
3 | class WorkAssignmentPluginTest < ActiveSupport::TestCase | 3 | class WorkAssignmentPluginTest < ActiveSupport::TestCase |
4 | should 'verify if a content is a work_assignment submission' do | 4 | should 'verify if a content is a work_assignment submission' do |
5 | organization = fast_create(Organization) | 5 | organization = fast_create(Organization) |
6 | - content = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :last_changed_by => fast_create(Person)) | 6 | + content = create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :created_by => fast_create(Person)) |
7 | assert !WorkAssignmentPlugin.is_submission?(content) | 7 | assert !WorkAssignmentPlugin.is_submission?(content) |
8 | 8 | ||
9 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) | 9 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) |
@@ -46,9 +46,11 @@ class WorkAssignmentPluginTest < ActiveSupport::TestCase | @@ -46,9 +46,11 @@ class WorkAssignmentPluginTest < ActiveSupport::TestCase | ||
46 | private | 46 | private |
47 | 47 | ||
48 | def create_submission(author=nil) | 48 | def create_submission(author=nil) |
49 | + author ||= fast_create(Person) | ||
49 | organization = fast_create(Organization) | 50 | organization = fast_create(Organization) |
51 | + | ||
50 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) | 52 | work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization) |
51 | - author_folder = work_assignment.find_or_create_author_folder(fast_create(Person)) | ||
52 | - create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => author_folder, :last_changed_by => author) | 53 | + author_folder = work_assignment.find_or_create_author_folder(author) |
54 | + create(UploadedFile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => author_folder, :created_by => author) | ||
53 | end | 55 | end |
54 | end | 56 | end |