From 55b3c879b54667527e0350a051b73d29b505ce3a Mon Sep 17 00:00:00 2001 From: Jacob Burroughs Date: Mon, 6 Jun 2022 09:24:00 -0500 Subject: [PATCH] Fix some rails 7.0 specs [ignore-stage-results=Flakey Spec Catcher] Change-Id: I969034adc9f70d7cec2e150e1e02676c0977e49a Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293321 Reviewed-by: Aaron Ogata Tested-by: Service Cloud Jenkins QA-Review: Jacob Burroughs Product-Review: Jacob Burroughs --- Gemfile.d/development.rb | 4 +- app/models/assignment.rb | 2 +- app/models/discussion_entry_participant.rb | 2 +- app/models/pseudonym.rb | 14 ++++++- app/models/quizzes/quiz.rb | 6 +-- config/initializers/active_record.rb | 4 +- config/initializers/strong_parameters.rb | 15 ++++--- lib/api/v1/planner_item.rb | 2 +- lib/user_search.rb | 10 ++--- .../v1/outcome_imports_api_controller_spec.rb | 12 +++--- spec/apis/v1/sis_imports_api_spec.rb | 42 +++++++++---------- .../group_categories_controller_spec.rb | 10 ++--- .../cc/exporter/web_zip/zip_package_spec.rb | 28 ++++++------- spec/models/attachment_spec.rb | 10 ++--- ...gnments_submissions_student_groups_spec.rb | 2 +- .../assignments_submissions_student_spec.rb | 2 +- .../context_modules_progressions_spec.rb | 2 +- .../context_modules/context_modules_spec.rb | 14 +++---- spec/selenium/dashboard/dashcards_spec.rb | 4 +- .../k5_announcements_shared_examples.rb | 2 +- spec/selenium/files/new_files_folders_spec.rb | 2 +- spec/selenium/files/new_files_spec.rb | 30 ++++++------- spec/selenium/files/new_files_student_spec.rb | 4 +- spec/selenium/helpers/groups_common.rb | 4 +- .../rcs/user_content_post_processing_spec.rb | 4 +- 25 files changed, 122 insertions(+), 109 deletions(-) diff --git a/Gemfile.d/development.rb b/Gemfile.d/development.rb index 73d0f946f40..d45021d432b 100644 --- a/Gemfile.d/development.rb +++ b/Gemfile.d/development.rb @@ -19,10 +19,10 @@ group :development do gem "letter_opener", "1.7.0" - gem "spring", "2.1.1" + gem "spring", "4.0.0" gem "spring-commands-parallel-rspec", "1.1.0" gem "spring-commands-rspec", "1.0.4" - gem "spring-commands-rubocop", "0.2.0" + gem "spring-commands-rubocop", "0.3.0", github: "rda1902/spring-commands-rubocop", ref: "818acb74130ac95adf9e8733986d45c168e4a5f3" gem "active_record_query_trace", "1.8", require: false gem "byebug", "11.1.3", platform: :mri diff --git a/app/models/assignment.rb b/app/models/assignment.rb index d4425f29ab9..447b8958b8c 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -2917,7 +2917,7 @@ class Assignment < ActiveRecord::Base from("(SELECT s.cached_due_date AS user_due_date, a.* FROM #{Assignment.quoted_table_name} a INNER JOIN #{Submission.quoted_table_name} AS s ON s.assignment_id = a.id - WHERE s.user_id = #{User.connection.quote(user)} AND s.workflow_state <> 'deleted') AS assignments") + WHERE s.user_id = #{User.connection.quote(user.id_for_database)} AND s.workflow_state <> 'deleted') AS assignments") } scope :with_latest_due_date, lambda { diff --git a/app/models/discussion_entry_participant.rb b/app/models/discussion_entry_participant.rb index f75b6a13ee3..efeb6d8da14 100644 --- a/app/models/discussion_entry_participant.rb +++ b/app/models/discussion_entry_participant.rb @@ -163,7 +163,7 @@ class DiscussionEntryParticipant < ActiveRecord::Base def self.row_values(batch_entry, user_id, root_account_id, default_state, update_values) [ - connection.quote(batch_entry), + connection.quote(batch_entry.is_a?(ActiveRecord::Base) ? batch_entry.id_for_database : batch_entry), connection.quote(user_id), connection.quote(root_account_id), connection.quote(default_state), diff --git a/app/models/pseudonym.rb b/app/models/pseudonym.rb index e87d73b84ad..18e0b13c67b 100644 --- a/app/models/pseudonym.rb +++ b/app/models/pseudonym.rb @@ -496,8 +496,18 @@ class Pseudonym < ActiveRecord::Base end alias_method :has_changes_to_save?, :changed? - def attribute_names_for_partial_writes - strip_inferred_authentication_provider(super) + if Rails.version < "7.0" + def attribute_names_for_partial_writes + strip_inferred_authentication_provider(super) + end + else + def attribute_names_for_partial_inserts + strip_inferred_authentication_provider(super) + end + + def attribute_names_for_partial_updates + strip_inferred_authentication_provider(super) + end end def strip_inferred_authentication_provider(attribute_names) diff --git a/app/models/quizzes/quiz.rb b/app/models/quizzes/quiz.rb index bc20fe95155..5bcac86f557 100644 --- a/app/models/quizzes/quiz.rb +++ b/app/models/quizzes/quiz.rb @@ -1195,14 +1195,14 @@ class Quizzes::Quiz < ActiveRecord::Base SELECT ao.quiz_id, aos.user_id, ao.due_at, ao.due_at_overridden, 1 AS priority FROM #{AssignmentOverride.quoted_table_name} ao INNER JOIN #{AssignmentOverrideStudent.quoted_table_name} aos ON ao.id = aos.assignment_override_id AND ao.set_type = 'ADHOC' - WHERE aos.user_id = #{User.connection.quote(user)} + WHERE aos.user_id = #{User.connection.quote(user.id_for_database)} AND ao.workflow_state = 'active' AND aos.workflow_state <> 'deleted' UNION SELECT ao.quiz_id, e.user_id, ao.due_at, ao.due_at_overridden, 1 AS priority FROM #{AssignmentOverride.quoted_table_name} ao INNER JOIN #{Enrollment.quoted_table_name} e ON e.course_section_id = ao.set_id AND ao.set_type = 'CourseSection' - WHERE e.user_id = #{User.connection.quote(user)} + WHERE e.user_id = #{User.connection.quote(user.id_for_database)} AND e.workflow_state NOT IN ('rejected', 'deleted', 'inactive') AND ao.workflow_state = 'active' UNION @@ -1211,7 +1211,7 @@ class Quizzes::Quiz < ActiveRecord::Base INNER JOIN #{Enrollment.quoted_table_name} e ON e.course_id = q.context_id WHERE e.workflow_state NOT IN ('rejected', 'deleted', 'inactive') AND e.type in ('StudentEnrollment', 'StudentViewEnrollment') - AND e.user_id = #{User.connection.quote(user)} + AND e.user_id = #{User.connection.quote(user.id_for_database)} AND q.assignment_id IS NULL AND NOT q.only_visible_to_overrides ) o diff --git a/config/initializers/active_record.rb b/config/initializers/active_record.rb index e276be762bb..948bc57bb88 100644 --- a/config/initializers/active_record.rb +++ b/config/initializers/active_record.rb @@ -746,10 +746,10 @@ class ActiveRecord::Base self.updated_at = Time.now.utc if touch if new_record? self.created_at = updated_at if touch - self.id = self.class._insert_record(attributes_with_values(attribute_names_for_partial_writes)) + self.id = self.class._insert_record(attributes_with_values(Rails.version < "7.0" ? attribute_names_for_partial_writes : attribute_names_for_partial_inserts)) @new_record = false else - update_columns(attributes_with_values(attribute_names_for_partial_writes)) + update_columns(attributes_with_values(Rails.version < "7.0" ? attribute_names_for_partial_writes : attribute_names_for_partial_updates)) end changes_applied end diff --git a/config/initializers/strong_parameters.rb b/config/initializers/strong_parameters.rb index 22584de3bd2..530b491438d 100644 --- a/config/initializers/strong_parameters.rb +++ b/config/initializers/strong_parameters.rb @@ -54,12 +54,15 @@ module ArbitraryStrongishParams end else # Declaration { user: :name } or { user: [:name, :age, { address: ... }] }. - params[key] = each_element(value) do |element| - if element.is_a?(Hash) || element.is_a?(ActionController::Parameters) - element = self.class.new(element) unless element.respond_to?(:permit) - element.permit(*Array.wrap(filter[key])) - end - end + params[key] = if Rails.version < "7.0" + each_element(value) do |element| + element.permit(*Array.wrap(filter[key])) + end + else + each_element(value, filter[key]) do |element| + element.permit(*Array.wrap(filter[key])) + end + end end end end diff --git a/lib/api/v1/planner_item.rb b/lib/api/v1/planner_item.rb index 4924c13f5d9..ad20400d753 100644 --- a/lib/api/v1/planner_item.rb +++ b/lib/api/v1/planner_item.rb @@ -210,7 +210,7 @@ module Api::V1::PlannerItem COALESCE(dtp.workflow_state, 'unread') AS unread_state") .joins("LEFT JOIN #{DiscussionTopicParticipant.quoted_table_name} AS dtp ON dtp.discussion_topic_id = discussion_topics.id - AND dtp.user_id = #{User.connection.quote(user)} + AND dtp.user_id = #{User.connection.quote(user&.id_for_database)} LEFT JOIN #{DiscussionEntry.quoted_table_name} AS de ON de.discussion_topic_id = discussion_topics.id AND dtp.id IS NULL") diff --git a/lib/user_search.rb b/lib/user_search.rb index b903b335a8b..7b69bb72faa 100644 --- a/lib/user_search.rb +++ b/lib/user_search.rb @@ -171,7 +171,7 @@ module UserSearch def id_sql(users_scope, params) users_scope.select("users.*, MAX(current_login_at) as last_login") .joins("LEFT JOIN #{Pseudonym.quoted_table_name} ON pseudonyms.user_id = users.id - AND pseudonyms.account_id = #{User.connection.quote(params[:account])} + AND pseudonyms.account_id = #{User.connection.quote(params[:account].id_for_database)} AND pseudonyms.workflow_state = 'active'") .where(id: params[:db_id]) .group(:id) @@ -180,7 +180,7 @@ module UserSearch def name_sql(users_scope, params) users_scope.select("users.*, MAX(current_login_at) as last_login") .joins("LEFT JOIN #{Pseudonym.quoted_table_name} ON pseudonyms.user_id = users.id - AND pseudonyms.account_id = #{User.connection.quote(params[:account])} + AND pseudonyms.account_id = #{User.connection.quote(params[:account].id_for_database)} AND pseudonyms.workflow_state = 'active'") .where(like_condition("users.name"), pattern: params[:pattern]) end @@ -189,7 +189,7 @@ module UserSearch users_scope.select("users.*, MAX(logins.current_login_at) as last_login") .joins(:pseudonyms) .joins("LEFT JOIN #{Pseudonym.quoted_table_name} AS logins ON logins.user_id = users.id - AND logins.account_id = #{User.connection.quote(params[:account])} + AND logins.account_id = #{User.connection.quote(params[:account].id_for_database)} AND logins.workflow_state = 'active'") .where(pseudonyms: { account_id: params[:account], workflow_state: "active" }) .where(like_condition("pseudonyms.unique_id"), pattern: params[:pattern]) @@ -199,7 +199,7 @@ module UserSearch users_scope.select("users.*, MAX(logins.current_login_at) as last_login") .joins(:pseudonyms) .joins("LEFT JOIN #{Pseudonym.quoted_table_name} AS logins ON logins.user_id = users.id - AND logins.account_id = #{User.connection.quote(params[:account])} + AND logins.account_id = #{User.connection.quote(params[:account].id_for_database)} AND logins.workflow_state = 'active'") .where(pseudonyms: { account_id: params[:account], workflow_state: ["active", "suspended"] }) .where(like_condition("pseudonyms.sis_user_id"), pattern: params[:pattern]) @@ -209,7 +209,7 @@ module UserSearch users_scope.select("users.*, MAX(current_login_at) as last_login") .joins(:communication_channels) .joins("LEFT JOIN #{Pseudonym.quoted_table_name} ON pseudonyms.user_id = users.id - AND pseudonyms.account_id = #{User.connection.quote(params[:account])} + AND pseudonyms.account_id = #{User.connection.quote(params[:account].id_for_database)} AND pseudonyms.workflow_state = 'active'") .where(communication_channels: { workflow_state: ["active", "unconfirmed"], path_type: params[:path_type] }) .where(like_condition("communication_channels.path"), pattern: params[:pattern]) diff --git a/spec/apis/v1/outcome_imports_api_controller_spec.rb b/spec/apis/v1/outcome_imports_api_controller_spec.rb index 35400f48656..7837422ae3b 100644 --- a/spec/apis/v1/outcome_imports_api_controller_spec.rb +++ b/spec/apis/v1/outcome_imports_api_controller_spec.rb @@ -54,7 +54,7 @@ describe OutcomeImportsApiController, type: :request do { controller: "outcome_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/outcomes/test_outcomes_1.csv", "text/csv") }) + attachment: fixture_file_upload("outcomes/test_outcomes_1.csv", "text/csv") }) end.to change { Delayed::Job.strand_size(strand) }.by(1) remaining_json = expect_keys(json, %w[created_at updated_at ended_at user]) @@ -97,7 +97,7 @@ describe OutcomeImportsApiController, type: :request do { controller: "outcome_imports_api", action: "create", format: "json", account_id: @account.id.to_s, learning_outcome_group_id: group.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/outcomes/test_outcomes_no_groups.csv", "text/csv") }) + attachment: fixture_file_upload("outcomes/test_outcomes_no_groups.csv", "text/csv") }) run_jobs end @@ -118,7 +118,7 @@ describe OutcomeImportsApiController, type: :request do { controller: "outcome_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/outcomes/test_outcomes_with_errors.csv", "text/csv") }) + attachment: fixture_file_upload("outcomes/test_outcomes_with_errors.csv", "text/csv") }) end it "if import is still being processed" do @@ -150,7 +150,7 @@ describe OutcomeImportsApiController, type: :request do { controller: "outcome_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/outcomes/test_outcomes_1.csv", "text/csv") }) + attachment: fixture_file_upload("outcomes/test_outcomes_1.csv", "text/csv") }) run_jobs @@ -222,7 +222,7 @@ describe OutcomeImportsApiController, type: :request do { controller: "outcome_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/outcomes/test_outcomes_1.csv", "text/csv") }, + attachment: fixture_file_upload("outcomes/test_outcomes_1.csv", "text/csv") }, {}, expected_status: 401) end @@ -234,7 +234,7 @@ describe OutcomeImportsApiController, type: :request do { controller: "outcome_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/outcomes/test_outcomes_1.csv", "text/csv") }, + attachment: fixture_file_upload("outcomes/test_outcomes_1.csv", "text/csv") }, {}, expected_status: 200) end diff --git a/spec/apis/v1/sis_imports_api_spec.rb b/spec/apis/v1/sis_imports_api_spec.rb index 6b79a65da5c..6496ec8505e 100644 --- a/spec/apis/v1/sis_imports_api_spec.rb +++ b/spec/apis/v1/sis_imports_api_spec.rb @@ -92,7 +92,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv") }) + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv") }) expect(Delayed::Job.where(singleton: "sis_batch:account:#{@account.id}").count).to eq 1 expect(json).to have_key("created_at") @@ -286,7 +286,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv") }) + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv") }) end.to change { Delayed::Job.strand_size("sis_batch:account:#{@account.id}") }.by(0) end @@ -296,7 +296,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), batch_mode: "1", batch_mode_term_id: @account.default_enrollment_term.id }) batch = SisBatch.find(json["id"]) @@ -310,7 +310,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), batch_mode: "1", change_threshold: 7, batch_mode_term_id: @account.default_enrollment_term.id }) @@ -324,7 +324,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), multi_term_batch_mode: "1" }) expect(json["message"]).to eq "change_threshold is required to use multi term_batch mode." end @@ -335,7 +335,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), batch_mode: "1", multi_term_batch_mode: "1", change_threshold: 7, }) @@ -350,7 +350,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), batch_mode: "true", clear_sis_stickiness: "true", override_sis_stickiness: "true", @@ -374,7 +374,7 @@ describe SisImportsApiController, type: :request do }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), update_sis_id_if_login_claimed: true } ) @@ -388,7 +388,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), diffing_data_set_identifier: "my-users-data", diffing_drop_status: "inactive", change_threshold: 7, @@ -410,7 +410,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), diffing_data_set_identifier: "my-users-data", diffing_remaster_data_set: "true", diffing_drop_status: "inactive", @@ -434,7 +434,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), diffing_data_set_identifier: "my-users-data", diffing_drop_status: "deleted_last_completed", change_threshold: 7, } @@ -453,7 +453,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), diffing_data_set_identifier: "my-users-data", diffing_drop_status: "invalid", change_threshold: 7, }, {}, expected_status: 400) @@ -467,7 +467,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), batch_mode: "1" }, {}, expected_status: 400) expect(json["message"]).to eq "Batch mode specified, but the given batch_mode_term_id cannot be found." end.to change(SisBatch, :count).by(0) @@ -479,7 +479,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv") }) + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv") }) batch = SisBatch.find(json["id"]) expect(batch.options).to eq({ skip_deletes: false, update_sis_id_if_login_claimed: false }) batch.destroy @@ -489,7 +489,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), override_sis_stickiness: "1" }) batch = SisBatch.find(json["id"]) expect(batch.options).to eq({ @@ -504,7 +504,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), override_sis_stickiness: "1", add_sis_stickiness: "1" }) batch = SisBatch.find(json["id"]) @@ -521,7 +521,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), override_sis_stickiness: "1", clear_sis_stickiness: "1" }) batch = SisBatch.find(json["id"]) @@ -538,7 +538,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), add_sis_stickiness: "1" }) batch = SisBatch.find(json["id"]) expect(batch.options).to eq({ skip_deletes: false, update_sis_id_if_login_claimed: false }) @@ -549,7 +549,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv"), + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv"), clear_sis_stickiness: "1" }) batch = SisBatch.find(json["id"]) expect(batch.options).to eq({ skip_deletes: false, update_sis_id_if_login_claimed: false }) @@ -958,7 +958,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv") }, + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv") }, {}, expected_status: 401) end @@ -970,7 +970,7 @@ describe SisImportsApiController, type: :request do { controller: "sis_imports_api", action: "create", format: "json", account_id: @account.id.to_s }, { import_type: "instructure_csv", - attachment: fixture_file_upload("files/sis/test_user_1.csv", "text/csv") }, + attachment: fixture_file_upload("sis/test_user_1.csv", "text/csv") }, {}, expected_status: 200) end diff --git a/spec/controllers/group_categories_controller_spec.rb b/spec/controllers/group_categories_controller_spec.rb index 9687ead3ab1..b5246a50858 100644 --- a/spec/controllers/group_categories_controller_spec.rb +++ b/spec/controllers/group_categories_controller_spec.rb @@ -345,7 +345,7 @@ describe GroupCategoriesController do post "import", params: { course_id: @course.id, group_category_id: @category.id, - attachment: fixture_file_upload("files/group_categories/test_group_categories.csv", "text/csv") + attachment: fixture_file_upload("group_categories/test_group_categories.csv", "text/csv") } assert_unauthorized end @@ -355,7 +355,7 @@ describe GroupCategoriesController do post "import", params: { course_id: @course.id, group_category_id: @category.id, - attachment: fixture_file_upload("files/group_categories/test_group_categories.csv", "text/csv") + attachment: fixture_file_upload("group_categories/test_group_categories.csv", "text/csv") } expect(response).to be_successful json = JSON.parse(response.body) @@ -370,7 +370,7 @@ describe GroupCategoriesController do post "import", params: { course_id: @course.id, group_category_id: @category.id, - attachment: fixture_file_upload("files/group_categories/test_group_categories.csv", "text/csv") + attachment: fixture_file_upload("group_categories/test_group_categories.csv", "text/csv") } expect(response).to be_successful json = JSON.parse(response.body) @@ -390,7 +390,7 @@ describe GroupCategoriesController do post "import", params: { course_id: @course.id, group_category_id: @category.id, - attachment: fixture_file_upload("files/group_categories/test_group_categories.csv", "text/csv") + attachment: fixture_file_upload("group_categories/test_group_categories.csv", "text/csv") } assert_unauthorized end @@ -400,7 +400,7 @@ describe GroupCategoriesController do post "import", params: { course_id: @course.id, group_category_id: @category.id, - attachment: fixture_file_upload("files/group_categories/test_group_categories.csv", "text/csv") + attachment: fixture_file_upload("group_categories/test_group_categories.csv", "text/csv") } expect(response).to be_successful diff --git a/spec/lib/cc/exporter/web_zip/zip_package_spec.rb b/spec/lib/cc/exporter/web_zip/zip_package_spec.rb index c41fe5dcffd..7cc458a4b1d 100644 --- a/spec/lib/cc/exporter/web_zip/zip_package_spec.rb +++ b/spec/lib/cc/exporter/web_zip/zip_package_spec.rb @@ -663,7 +663,7 @@ describe "ZipPackage" do end it "exports files" do - add_file(fixture_file_upload("files/amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") + add_file(fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") zip_package = create_zip_package course_data = zip_package.parse_course_data expect(course_data[:files]).to eq [{ type: "file", name: "amazing_file.txt", size: 26, files: nil }] @@ -683,8 +683,8 @@ describe "ZipPackage" do it "does not export items not linked elsewhere" do @course.assignments.create!(title: "Assignment 1") - add_file(fixture_file_upload("files/amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") - file = add_file(fixture_file_upload("files/cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") + add_file(fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") + file = add_file(fixture_file_upload("cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") @module.content_tags.create!(content: file, context: @course, indent: 0) zip_package = create_zip_package course_data = zip_package.parse_course_data @@ -694,7 +694,7 @@ describe "ZipPackage" do it "exports items that are module items" do assign = @course.assignments.create!(title: "Assignment 1", description: "

Hi

") - file = add_file(fixture_file_upload("files/amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") + file = add_file(fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") @module.content_tags.create!(content: assign, context: @course, indent: 0) @module.content_tags.create!(content: file, context: @course, indent: 0) zip_package = create_zip_package @@ -766,7 +766,7 @@ describe "ZipPackage" do end it "exports files linked from module items" do - file = add_file(fixture_file_upload("files/amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") + file = add_file(fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") assign = @course.assignments.create!(title: "Assignment 1", description: "Link") @module.content_tags.create!(content: assign, context: @course, indent: 0) @@ -779,7 +779,7 @@ describe "ZipPackage" do end it "exports items linked from other linked items" do - file = add_file(fixture_file_upload("files/amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") + file = add_file(fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") assign = @course.assignments.create!(title: "Assignment 1", description: "Link") page = @course.wiki_pages.create!(title: "Page 1", wiki: @course.wiki, @@ -797,12 +797,12 @@ describe "ZipPackage" do end it "exports media files linked from other linked items" do - media = add_file(fixture_file_upload("files/292.mp3", "audio/mpeg"), @course, "292.mp3") + media = add_file(fixture_file_upload("292.mp3", "audio/mpeg"), @course, "292.mp3") image = - add_file(fixture_file_upload("files/cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") + add_file(fixture_file_upload("cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") text = add_file( - fixture_file_upload("files/amazing_file.txt", "plain/txt"), + fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt" ) @@ -880,7 +880,7 @@ describe "ZipPackage" do end it "doesn't blow up when content is exported with a special reference without a path" do - media = add_file(fixture_file_upload("files/292.mp3", "audio/mpeg"), @course, "292.mp3") + media = add_file(fixture_file_upload("292.mp3", "audio/mpeg"), @course, "292.mp3") page = @course.wiki_pages.create!( title: "Home Page", @@ -920,7 +920,7 @@ describe "ZipPackage" do it "exports items linked as images" do due_at = 1.day.ago - file = add_file(fixture_file_upload("files/cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") + file = add_file(fixture_file_upload("cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") survey = @course.quizzes.create!(title: "Survey 1", due_at: due_at, quiz_type: "survey", description: "") survey.publish! @@ -964,7 +964,7 @@ describe "ZipPackage" do it "exports linked file items in sub-folders" do folder = @course.folders.create!(name: "folder#1", parent_folder: Folder.root_folders(@course).first) - file = add_file(fixture_file_upload("files/cn_image.jpg", "image/jpg"), @course, "cn_image.jpg", folder) + file = add_file(fixture_file_upload("cn_image.jpg", "image/jpg"), @course, "cn_image.jpg", folder) disc = @course.discussion_topics.create!(title: "Discussion 1", message: "") @module.content_tags.create!(content: disc, context: @course, indent: 0) @@ -989,8 +989,8 @@ describe "ZipPackage" do end it "does not mark locked items as exported" do - file = add_file(fixture_file_upload("files/amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") - file2 = add_file(fixture_file_upload("files/cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") + file = add_file(fixture_file_upload("amazing_file.txt", "plain/txt"), @course, "amazing_file.txt") + file2 = add_file(fixture_file_upload("cn_image.jpg", "image/jpg"), @course, "cn_image.jpg") page = @course.wiki_pages.create!(title: "Page 1", wiki: @course.wiki, body: "

stuff

") @module.content_tags.create!(content: file2, context: @course) diff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rb index 2fa965bd69e..00bbbce1709 100644 --- a/spec/models/attachment_spec.rb +++ b/spec/models/attachment_spec.rb @@ -2585,31 +2585,31 @@ describe Attachment do end it "updates the word count for a PDF" do - attachment_model(filename: "test.pdf", uploaded_data: fixture_file_upload("files/example.pdf", "application/pdf")) + attachment_model(filename: "test.pdf", uploaded_data: fixture_file_upload("example.pdf", "application/pdf")) @attachment.update_word_count expect(@attachment.word_count).to eq 3320 end it "updates the word count for a DOCX file" do - attachment_model(filename: "test.docx", uploaded_data: fixture_file_upload("files/test.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")) + attachment_model(filename: "test.docx", uploaded_data: fixture_file_upload("test.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")) @attachment.update_word_count expect(@attachment.word_count).to eq 5 end it "updates the word count for an RTF file" do - attachment_model(filename: "test.rtf", uploaded_data: fixture_file_upload("files/test.rtf", "application/rtf")) + attachment_model(filename: "test.rtf", uploaded_data: fixture_file_upload("test.rtf", "application/rtf")) @attachment.update_word_count expect(@attachment.word_count).to eq 5 end it "updates the word count for a text file" do - attachment_model(filename: "test.txt", uploaded_data: fixture_file_upload("files/amazing_file.txt", "text/plain")) + attachment_model(filename: "test.txt", uploaded_data: fixture_file_upload("amazing_file.txt", "text/plain")) @attachment.update_word_count expect(@attachment.word_count).to eq 5 end it "sets 0 if the file is not supported" do - attachment_model(filename: "test.png", uploaded_data: fixture_file_upload("files/instructure.png", "image/png")) + attachment_model(filename: "test.png", uploaded_data: fixture_file_upload("instructure.png", "image/png")) @attachment.update_word_count expect(@attachment.word_count).to eq 0 end diff --git a/spec/selenium/assignments/assignments_submissions_student_groups_spec.rb b/spec/selenium/assignments/assignments_submissions_student_groups_spec.rb index 5d2eda39544..1014913c15f 100644 --- a/spec/selenium/assignments/assignments_submissions_student_groups_spec.rb +++ b/spec/selenium/assignments/assignments_submissions_student_groups_spec.rb @@ -41,7 +41,7 @@ describe "submissions" do it "Submitting Group Assignments - File Upload", priority: "1" do create_assignment_for_group("online_upload") - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), + add_file(fixture_file_upload("example.pdf", "application/pdf"), @student, "example.pdf") get "/courses/#{@course.id}/assignments/#{@assignment.id}" f(".submit_assignment_link").click diff --git a/spec/selenium/assignments/assignments_submissions_student_spec.rb b/spec/selenium/assignments/assignments_submissions_student_spec.rb index e2e6953f6a1..27d3173dce2 100644 --- a/spec/selenium/assignments/assignments_submissions_student_spec.rb +++ b/spec/selenium/assignments/assignments_submissions_student_spec.rb @@ -416,7 +416,7 @@ describe "submissions" do it "allows uploaded files to be used for submission", priority: "1" do local_storage! - add_file(fixture_file_upload("files/html-editing-test.html", "text/html"), + add_file(fixture_file_upload("html-editing-test.html", "text/html"), @student, "html-editing-test.html") File.read(fixture_file_path("files/html-editing-test.html")) assignment = @course.assignments.create!(title: "assignment 1", diff --git a/spec/selenium/context_modules/context_modules_progressions_spec.rb b/spec/selenium/context_modules/context_modules_progressions_spec.rb index e8068c60f56..a7f37942299 100644 --- a/spec/selenium/context_modules/context_modules_progressions_spec.rb +++ b/spec/selenium/context_modules/context_modules_progressions_spec.rb @@ -346,7 +346,7 @@ describe "context modules" do end it "shows student progress once File-view requirement is met", priority: "1" do - @file = @course.attachments.create!(display_name: "file", uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + @file = @course.attachments.create!(display_name: "file", uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) @file.context = @course @file.save! tag = @module1.add_item({ id: @file.id, type: "attachment" }) diff --git a/spec/selenium/context_modules/context_modules_spec.rb b/spec/selenium/context_modules/context_modules_spec.rb index 1d5908ddb38..02004500fce 100644 --- a/spec/selenium/context_modules/context_modules_spec.rb +++ b/spec/selenium/context_modules/context_modules_spec.rb @@ -360,7 +360,7 @@ describe "context modules" do it "does not duplicate items on multiple uploads when replace is chosen" do # create the existing module item filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @mod.add_item({ id: file.id, type: "attachment" }) @@ -375,7 +375,7 @@ describe "context modules" do it "adds an uploaded file if the same content was just deleted" do filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @mod.add_item({ id: file.id, type: "attachment" }) @@ -395,7 +395,7 @@ describe "context modules" do it "replaces an existing module item with a replacement uploaded file" do # create the existing module item filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @mod.add_item({ id: file.id, type: "attachment" }) @@ -409,7 +409,7 @@ describe "context modules" do it "closing the rename dialog should not close the module dialog" do filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @@ -439,7 +439,7 @@ describe "context modules" do it "skipping the only file should not close the add item to module dialog" do filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @@ -460,7 +460,7 @@ describe "context modules" do it "does not ask to rename upload after folder change" do filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @@ -490,7 +490,7 @@ describe "context modules" do it "creates a module item with a replacement uploaded file if in a different module" do # create the existing module item filename, fullpath, _data = get_file("a_file.txt") - file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain")) + file = @course.attachments.create!(display_name: filename, uploaded_data: fixture_file_upload("a_file.txt", "text/plain")) file.context = @course file.save! @mod.add_item({ id: file.id, type: "attachment" }) diff --git a/spec/selenium/dashboard/dashcards_spec.rb b/spec/selenium/dashboard/dashcards_spec.rb index b2bca7d7b6d..a678f956a9b 100644 --- a/spec/selenium/dashboard/dashcards_spec.rb +++ b/spec/selenium/dashboard/dashcards_spec.rb @@ -85,7 +85,7 @@ describe "dashcards" do it "redirects to files index", priority: "1" do # Icon will not display unless there is a file. - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), @course, "example.pdf") + add_file(fixture_file_upload("example.pdf", "application/pdf"), @course, "example.pdf") get "/" f("a.files").click @@ -103,7 +103,7 @@ describe "dashcards" do @course.discussion_topics.create!(title: "discussion 1", message: "This is a message.") @course.assignments.create!(title: "assignment 1", name: "assignment 1") create_announcement - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), @course, "example.pdf") + add_file(fixture_file_upload("example.pdf", "application/pdf"), @course, "example.pdf") get "/" expect(f("a.announcements")).to be_present diff --git a/spec/selenium/dashboard/shared_examples/k5_announcements_shared_examples.rb b/spec/selenium/dashboard/shared_examples/k5_announcements_shared_examples.rb index f7b8f91f914..e9ca49f9af6 100644 --- a/spec/selenium/dashboard/shared_examples/k5_announcements_shared_examples.rb +++ b/spec/selenium/dashboard/shared_examples/k5_announcements_shared_examples.rb @@ -115,7 +115,7 @@ shared_examples_for "k5 homeroom announcements" do context "announcement attachments" do before :once do - attachment_model(uploaded_data: fixture_file_upload("files/example.pdf", "application/pdf")) + attachment_model(uploaded_data: fixture_file_upload("example.pdf", "application/pdf")) @homeroom_course.announcements.create!( title: "Welcome to class", message: "Hello!", diff --git a/spec/selenium/files/new_files_folders_spec.rb b/spec/selenium/files/new_files_folders_spec.rb index 576e3332af8..a8d8c60a40d 100644 --- a/spec/selenium/files/new_files_folders_spec.rb +++ b/spec/selenium/files/new_files_folders_spec.rb @@ -142,7 +142,7 @@ describe "better_file_browsing, folders" do end it "displays folders in tree view", priority: "1" do - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), + add_file(fixture_file_upload("example.pdf", "application/pdf"), @course, "example.pdf") get "/courses/#{@course.id}/files" create_new_folder diff --git a/spec/selenium/files/new_files_spec.rb b/spec/selenium/files/new_files_spec.rb index dc5d3229785..d42c192f231 100644 --- a/spec/selenium/files/new_files_spec.rb +++ b/spec/selenium/files/new_files_spec.rb @@ -40,7 +40,7 @@ describe "better_file_browsing" do add_folder("A New Folder") created_folder = @teacher.folders.find_by(name: "A New Folder") expect(created_folder).to be_present - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), @user, "example.pdf", created_folder) + add_file(fixture_file_upload("example.pdf", "application/pdf"), @user, "example.pdf", created_folder) fj('a.treeLabel:contains("A New Folder")').click wait_for_ajaximations expect(ff(".ef-name-col__text")[0]).to include_text "example.pdf" @@ -50,7 +50,7 @@ describe "better_file_browsing" do context "As a teacher" do before(:once) do course_with_teacher(active_all: true) - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), + add_file(fixture_file_upload("example.pdf", "application/pdf"), @course, "example.pdf") end @@ -205,7 +205,7 @@ describe "better_file_browsing" do course_with_teacher_logged_in txt_files = ["a_file.txt", "b_file.txt", "c_file.txt"] txt_files.map do |text_file| - add_file(fixture_file_upload("files/#{text_file}", "text/plain"), @course, text_file) + add_file(fixture_file_upload(text_file.to_s, "text/plain"), @course, text_file) end get "/courses/#{@course.id}/files" end @@ -221,7 +221,7 @@ describe "better_file_browsing" do before(:once) do course_with_teacher(active_all: true) txt_files = ["a_file.txt", "b_file.txt", "c_file.txt"] - txt_files.map { |text_file| add_file(fixture_file_upload("files/#{text_file}", "text/plain"), @course, text_file) } + txt_files.map { |text_file| add_file(fixture_file_upload(text_file.to_s, "text/plain"), @course, text_file) } end before do @@ -284,9 +284,9 @@ describe "better_file_browsing" do before(:once) do user_files = ["a_file.txt", "b_file.txt"] - user_files.map { |text_file| add_file(fixture_file_upload("files/#{text_file}", "text/plain"), @teacher, text_file) } + user_files.map { |text_file| add_file(fixture_file_upload(text_file.to_s, "text/plain"), @teacher, text_file) } # Course file - add_file(fixture_file_upload("files/c_file.txt", "text/plain"), @course, "c_file.txt") + add_file(fixture_file_upload("c_file.txt", "text/plain"), @course, "c_file.txt") end let(:folder_name) { "destination_folder" } @@ -310,7 +310,7 @@ describe "better_file_browsing" do context "Publish Cloud Dialog" do before(:once) do course_with_teacher(active_all: true) - add_file(fixture_file_upload("files/a_file.txt", "text/plain"), + add_file(fixture_file_upload("a_file.txt", "text/plain"), @course, "a_file.txt") end @@ -335,9 +335,9 @@ describe "better_file_browsing" do context "File Preview" do before do course_with_teacher_logged_in - add_file(fixture_file_upload("files/a_file.txt", "text/plain"), + add_file(fixture_file_upload("a_file.txt", "text/plain"), @course, "a_file.txt") - add_file(fixture_file_upload("files/b_file.txt", "text/plain"), + add_file(fixture_file_upload("b_file.txt", "text/plain"), @course, "b_file.txt") get "/courses/#{@course.id}/files" end @@ -370,11 +370,11 @@ describe "better_file_browsing" do course_with_teacher(active_all: true) @course.usage_rights_required = true @course.save! - add_file(fixture_file_upload("files/a_file.txt", "text/plan"), + add_file(fixture_file_upload("a_file.txt", "text/plan"), @course, "a_file.txt") - add_file(fixture_file_upload("files/amazing_file.txt", "text/plan"), + add_file(fixture_file_upload("amazing_file.txt", "text/plan"), @user, "amazing_file.txt") - add_file(fixture_file_upload("files/a_file.txt", "text/plan"), + add_file(fixture_file_upload("a_file.txt", "text/plan"), @user, "a_file.txt") end @@ -479,7 +479,7 @@ describe "better_file_browsing" do course_with_teacher_logged_in @course.usage_rights_required = true @course.save! - add_file(fixture_file_upload("files/b_file.txt", "text/plain"), @course, "b_file.txt") + add_file(fixture_file_upload("b_file.txt", "text/plain"), @course, "b_file.txt") get "/courses/#{@course.id}/files" expect(f(".btn-link.published-status.published")).to be_displayed @@ -491,8 +491,8 @@ describe "better_file_browsing" do # this test performs 2 sample sort combinations course_with_teacher_logged_in - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), @course, "a_example.pdf") - add_file(fixture_file_upload("files/b_file.txt", "text/plain"), @course, "b_file.txt") + add_file(fixture_file_upload("example.pdf", "application/pdf"), @course, "a_example.pdf") + add_file(fixture_file_upload("b_file.txt", "text/plain"), @course, "b_file.txt") get "/courses/#{@course.id}/files" diff --git a/spec/selenium/files/new_files_student_spec.rb b/spec/selenium/files/new_files_student_spec.rb index 1d3b75ce9d3..dc712c621a3 100644 --- a/spec/selenium/files/new_files_student_spec.rb +++ b/spec/selenium/files/new_files_student_spec.rb @@ -42,7 +42,7 @@ describe "better_file_browsing" do before :once do txt_files = ["a_file.txt", "b_file.txt", "c_file.txt"] @files = txt_files.map do |text_file| - add_file(fixture_file_upload("files/#{text_file}", "text/plain"), @course, text_file) + add_file(fixture_file_upload(text_file.to_s, "text/plain"), @course, text_file) end end @@ -108,7 +108,7 @@ describe "better_file_browsing" do context "in course with folders" do before :once do @folder = folder_model(name: "restricted_folder", context: @course) - @file = add_file(fixture_file_upload("files/example.pdf", "application/pdf"), + @file = add_file(fixture_file_upload("example.pdf", "application/pdf"), @course, "example.pdf", @folder) end diff --git a/spec/selenium/helpers/groups_common.rb b/spec/selenium/helpers/groups_common.rb index 28c06cf4378..1e715690bd0 100644 --- a/spec/selenium/helpers/groups_common.rb +++ b/spec/selenium/helpers/groups_common.rb @@ -351,9 +351,9 @@ module GroupsCommon @testgroup.first end - add_file(fixture_file_upload("files/example.pdf", "application/pdf"), + add_file(fixture_file_upload("example.pdf", "application/pdf"), @testgroup.first, "example.pdf") - add_file(fixture_file_upload("files/a_file.txt", "text/plain"), + add_file(fixture_file_upload("a_file.txt", "text/plain"), second_file_context, "a_file.txt") end diff --git a/spec/selenium/rcs/user_content_post_processing_spec.rb b/spec/selenium/rcs/user_content_post_processing_spec.rb index 427e47a8116..8ba7006778a 100644 --- a/spec/selenium/rcs/user_content_post_processing_spec.rb +++ b/spec/selenium/rcs/user_content_post_processing_spec.rb @@ -28,7 +28,7 @@ describe "user_content post processing" do @course.attachments.create!( display_name: "file", context: @teacher, - uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain") + uploaded_data: fixture_file_upload("a_file.txt", "text/plain") ) @file.save! @file_url = "/users/#{@teacher.id}/files/#{@file.id}" @@ -178,7 +178,7 @@ describe "user_content post processing" do @teacher.attachments.create!( display_name: "file", context: @teacher, - uploaded_data: fixture_file_upload("files/a_file.txt", "text/plain") + uploaded_data: fixture_file_upload("a_file.txt", "text/plain") ) file.save! file_url = "/users/#{@teacher.id}/files/#{file.id}"