Commit 6ee23a50812205ecc3beab40ccb7f72ae423ac56

Authored by Antonio Terceiro
1 parent c63abafb

work_assignment plugin: fix tests

the assumption on authorship changed from last_changed_by to created_by
plugins/work_assignment/test/unit/work_assingment_plugin/work_assignment_test.rb
... ... @@ -35,7 +35,7 @@ class WorkAssignmentTest < ActiveSupport::TestCase
35 35 organization = fast_create(Organization)
36 36 author = fast_create(Person)
37 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 40 author_folder = work_assignment.find_or_create_author_folder(author)
41 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 3 class WorkAssignmentPluginTest < ActiveSupport::TestCase
4 4 should 'verify if a content is a work_assignment submission' do
5 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 7 assert !WorkAssignmentPlugin.is_submission?(content)
8 8  
9 9 work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => organization)
... ... @@ -46,9 +46,11 @@ class WorkAssignmentPluginTest &lt; ActiveSupport::TestCase
46 46 private
47 47  
48 48 def create_submission(author=nil)
  49 + author ||= fast_create(Person)
49 50 organization = fast_create(Organization)
  51 +
50 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 55 end
54 56 end
... ...