OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
remove legacy specs covered by other specs
ulferts2b4b773e6a2a
diff --git a/spec_legacy/functional/wiki_controller_spec.rb b/spec_legacy/functional/wiki_controller_spec.rbindex 366bf9567be..4d80c45eae9 100644--- a/spec_legacy/functional/wiki_controller_spec.rb+++ b/spec_legacy/functional/wiki_controller_spec.rb@@ -100,25 +100,6 @@ describe WikiController, type: :controller doassert_equal 'Created the page', page.content.last_journal.notesend- it 'should create page with attachments' do- session[:user_id] = 2- assert_difference 'WikiPage.count' do- assert_difference 'Attachment.count' do- post :create, params: { project_id: 1,- id: 'New page',- content: { comments: 'Created the page',- text: "h1. New page\n\nThis is a new page",- lock_version: 0,- page: { title: 'Freshly created page',- parent_id: '' } },- attachments: { '1' => { 'file' => uploaded_test_file('testfile.txt', 'text/plain') } } }- end- end- page = wiki.find_page('Freshly created page')- assert_equal 1, page.attachments.count- assert_equal 'testfile.txt', page.attachments.first.filename- end-it 'should update page with failure' dosession[:user_id] = 2assert_no_difference 'WikiPage.count' do@@ -144,52 +125,6 @@ describe WikiController, type: :controller doassert_select 'input', attributes: { id: 'content_lock_version', value: '1' }end- # NOTE: this test seems to depend on other tests in suite- # because running whole suite is fine, but running only this test- # results in failure- it 'should update stale page should not raise an error' do- FactoryBot.create :wiki_content_journal,- journable_id: 2,- version: 1,- data: FactoryBot.build(:journal_wiki_content_journal,- text: "h1. Another page\n\n\nthis is a link to ticket: #2")- session[:user_id] = 2- c = Wiki.find(1).find_page('Another page').content- c.text = 'Previous text'- c.save!- assert_equal 2, c.version-- assert_no_difference 'WikiPage.count' do- assert_no_difference 'WikiContent.count' do- assert_no_difference 'Journal.count' do- put :update, params: { project_id: 1,- id: 'Another page',- content: {- comments: 'My comments',- text: 'Text should not be lost',- lock_version: 1,- page: { title: 'Another page',- parent_id: '' }- } }- end- end- end- assert_response :success- assert_template 'edit'- assert_select 'div',- attributes: { class: /error/ },- content: /Information has been updated by at least one other user in the meantime/- assert_select 'textarea',- attributes: { name: 'content[text]' },- content: /Text should not be lost/- assert_select 'input',- attributes: { name: 'content[comments]', value: 'My comments' }-- c.reload- assert_equal 'Previous text', c.text- assert_equal 2, c.version- end-it 'should history' doFactoryBot.create :wiki_content_journal,journable_id: 1,diff --git a/spec_legacy/legacy_spec_helper.rb b/spec_legacy/legacy_spec_helper.rbindex b7e628afe5e..ff0f29bfd6c 100644--- a/spec_legacy/legacy_spec_helper.rb+++ b/spec_legacy/legacy_spec_helper.rb@@ -55,8 +55,6 @@ RSpec.configure do |config|config.include LegacyAssertionsAndHelpersconfig.include ActiveSupport::Testing::Assertionsconfig.include Shoulda::Context::Assertions- # included in order to use #fixture_file_upload- config.include ActionDispatch::TestProcessconfig.include RSpec::Rails::RequestExampleGroup, file_path: %r(spec_legacy/integration)config.include Shoulda::Matchers::ActionController, file_path: %r(spec_legacy/integration)@@ -80,8 +78,6 @@ RSpec.configure do |config|config.before(:each) doreset_global_state!- initialize_attachments-I18n.locale = 'en'enddiff --git a/spec_legacy/support/legacy_assertions.rb b/spec_legacy/support/legacy_assertions.rbindex cd5a4c4ab51..82259cdcc1f 100644--- a/spec_legacy/support/legacy_assertions.rb+++ b/spec_legacy/support/legacy_assertions.rb@@ -38,28 +38,6 @@ module LegacyAssertionsAndHelpersRequestStore.clear!end- ##- # Attachments generated through fixtures do not files associated with them even- # when one provides them within the fixture yml. Dunno why.- #- # This method fixes that. Tries to lookup existing files. Generates temporary files- # where none exist.- def initialize_attachments- Attachment.all.each do |a|- if a.file.filename.nil?- begin # existing file under `spec/fixtures/files`- a.file = uploaded_test_file a.disk_filename, a.attributes['content_type'],- original_filename: a.attributes['filename']- rescue # imaginary file: create it on-the-fly- a.file = LegacyFileHelpers.mock_uploaded_file name: a.attributes['filename'],- content_type: a.attributes['content_type']- end-- a.save!- end- end- end-def log_user(login, password)User.anonymousget '/login'@@ -70,46 +48,6 @@ module LegacyAssertionsAndHelpersassert_equal login, User.find(session[:user_id]).loginend- ##- # Creates a UploadedFile for a file in the fixtures under `spec/fixtures/files`.- # Optionally allows to override the original filename.- #- # Shortcut for Rack::Test::UploadedFile.new(- # ActionController::TestCase.fixture_path + path, mime)- def uploaded_test_file(name, mime, original_filename: nil)- file = fixture_file_upload("/files/#{name}", mime, true)- file.define_singleton_method(:original_filename) { original_filename } if original_filename- file- end-- def save_and_open_page- body = response.body-- body.gsub!('/assets', '../../public/assets')-- FileUtils.mkdir_p(Rails.root.join('tmp/pages'))-- page_path = Rails.root.join("tmp/pages/#{SecureRandom.hex(16)}.html").to_s- File.open(page_path, 'w') do |f| f.write(body) end-- Launchy.open(page_path)-- begin- binding.pry- rescue NoMethodError- debugger- end-- FileUtils.rm(page_path)- end-- # Use a temporary directory for attachment related tests- def set_tmp_attachments_directory- attachments_path = Rails.root.join('tmp/test/attachments')- FileUtils.mkdir_p(attachments_path)- Attachment.storage_path = attachments_path.to_s- end-def with_settings(options, &_block)saved_settings = options.keys.inject({}) { |h, k| h[k] = Setting[k].dup; h }options.each do |k, v| Setting[k] = v end@@ -118,13 +56,6 @@ module LegacyAssertionsAndHelperssaved_settings.each { |k, v| Setting[k] = v }end- def change_user_password(login, new_password)- user = User.find_by_login(login)- user.password = new_password- user.password_confirmation = new_password- user.save!- end-# Shoulda macrosdef should_assign_to(variable, &block)# it "assign the instance variable '#{variable}'" do@@ -141,15 +72,6 @@ module LegacyAssertionsAndHelpersshould render_template 'common/error'end- def should_create_a_new_user(&block)- # it "create a new user" do- user = instance_eval &block- assert user- assert_kind_of User, user- assert !user.new_record?- # end- end-def should_respond_with_content_type(content_type)# it "respond with content type '#{content_type}'" doassert_equal response.content_type, content_type