diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/show/redirects_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects/show/user_sees_git_instructions_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/issuable/common_system_notes_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/work_items/callbacks/current_user_todos_spec.rb (renamed from spec/services/work_items/widgets/current_user_todos_service/update_service_spec.rb) | 20 | ||||
-rw-r--r-- | spec/support/helpers/database/duplicate_indexes.yml | 13 | ||||
-rw-r--r-- | spec/support/shared_examples/services/common_system_notes_shared_examples.rb | 6 |
6 files changed, 20 insertions, 27 deletions
diff --git a/spec/features/projects/show/redirects_spec.rb b/spec/features/projects/show/redirects_spec.rb index ef326b92b98..a0424831973 100644 --- a/spec/features/projects/show/redirects_spec.rb +++ b/spec/features/projects/show/redirects_spec.rb @@ -14,7 +14,7 @@ RSpec.describe 'Projects > Show > Redirects', feature_category: :groups_and_proj it 'shows public project page' do visit project_path(public_project) - page.within '.breadcrumbs .breadcrumb-item-text' do + page.within '.breadcrumbs .js-breadcrumb-item-text' do expect(page).to have_content(public_project.name) end end diff --git a/spec/features/projects/show/user_sees_git_instructions_spec.rb b/spec/features/projects/show/user_sees_git_instructions_spec.rb index 4933b3f239c..40549beae9f 100644 --- a/spec/features/projects/show/user_sees_git_instructions_spec.rb +++ b/spec/features/projects/show/user_sees_git_instructions_spec.rb @@ -49,7 +49,7 @@ RSpec.describe 'Projects > Show > User sees Git instructions', feature_category: let(:user_has_ssh_key) { false } it 'shows details' do - page.within('.breadcrumbs .breadcrumb-item-text') do + page.within('.breadcrumbs .js-breadcrumb-item-text') do expect(page).to have_content(project.title) end diff --git a/spec/services/issuable/common_system_notes_service_spec.rb b/spec/services/issuable/common_system_notes_service_spec.rb index 3d83c9ec9c2..fb2292bfe64 100644 --- a/spec/services/issuable/common_system_notes_service_spec.rb +++ b/spec/services/issuable/common_system_notes_service_spec.rb @@ -142,5 +142,9 @@ RSpec.describe Issuable::CommonSystemNotesService, feature_category: :team_plann context 'when changing dates' do it_behaves_like 'system note for issuable date changes' end + + context 'when setting an estimae' do + it_behaves_like 'system note creation', { time_estimate: 5 }, 'changed time estimate', false + end end end diff --git a/spec/services/work_items/widgets/current_user_todos_service/update_service_spec.rb b/spec/services/work_items/callbacks/current_user_todos_spec.rb index aa7257e9e62..0f16687e620 100644 --- a/spec/services/work_items/widgets/current_user_todos_service/update_service_spec.rb +++ b/spec/services/work_items/callbacks/current_user_todos_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, feature_category: :team_planning do +RSpec.describe WorkItems::Callbacks::CurrentUserTodos, feature_category: :team_planning do let_it_be(:reporter) { create(:user) } let_it_be(:project) { create(:project, :private) } let_it_be(:current_user) { reporter } @@ -25,16 +25,16 @@ RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, featu create(:todo, state: :pending, target: work_item, target_type: work_item.class.name, user: create(:user)) end - let(:widget) { work_item.widgets.find { |widget| widget.is_a?(WorkItems::Widgets::CurrentUserTodos) } } + let(:widget) { work_item.widgets.find { |widget| widget.is_a?(WorkItems::Callbacks::CurrentUserTodos) } } before_all do project.add_reporter(reporter) end describe '#before_update_in_transaction' do - subject do - described_class.new(widget: widget, current_user: current_user) - .before_update_in_transaction(params: params) + subject(:service) do + described_class.new(issuable: work_item, current_user: current_user, params: params) + .before_update end context 'when adding a todo' do @@ -44,7 +44,7 @@ RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, featu let(:current_user) { create(:user) } it 'does add a todo' do - expect { subject }.not_to change { Todo.count } + expect { service }.not_to change { Todo.count } end end @@ -52,7 +52,7 @@ RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, featu let(:params) { { action: "add" } } it 'creates a new todo for the user and the work item' do - expect { subject }.to change { current_user.todos.count }.by(1) + expect { service }.to change { current_user.todos.count }.by(1) todo = current_user.todos.last @@ -69,7 +69,7 @@ RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, featu let(:current_user) { create(:user) } it 'does not change todo status' do - subject + service expect(pending_todo1.reload).to be_pending expect(pending_todo2.reload).to be_pending @@ -80,7 +80,7 @@ RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, featu context 'when resolving all todos of the work item', :aggregate_failures do it 'resolves todos of the user for the work item' do - subject + service expect(pending_todo1.reload).to be_done expect(pending_todo2.reload).to be_done @@ -93,7 +93,7 @@ RSpec.describe WorkItems::Widgets::CurrentUserTodosService::UpdateService, featu let(:params) { { action: "mark_as_done", todo_id: pending_todo1.id } } it 'resolves todos of the user for the work item' do - subject + service expect(pending_todo1.reload).to be_done expect(pending_todo2.reload).to be_pending diff --git a/spec/support/helpers/database/duplicate_indexes.yml b/spec/support/helpers/database/duplicate_indexes.yml index 87a1e0c2c50..acfda313020 100644 --- a/spec/support/helpers/database/duplicate_indexes.yml +++ b/spec/support/helpers/database/duplicate_indexes.yml @@ -105,19 +105,6 @@ ml_models: p_ci_runner_machine_builds: index_p_ci_runner_machine_builds_on_runner_machine_id: - index_ci_runner_machine_builds_on_runner_machine_id -packages_debian_group_distributions: - uniq_pkgs_debian_group_distributions_group_id_and_codename: - - index_packages_debian_group_distributions_on_group_id - uniq_pkgs_debian_group_distributions_group_id_and_suite: - - index_packages_debian_group_distributions_on_group_id -packages_debian_project_distributions: - uniq_pkgs_debian_project_distributions_project_id_and_codename: - - index_packages_debian_project_distributions_on_project_id - uniq_pkgs_debian_project_distributions_project_id_and_suite: - - index_packages_debian_project_distributions_on_project_id -packages_tags: - index_packages_tags_on_package_id_and_updated_at: - - index_packages_tags_on_package_id pages_domains: index_pages_domains_on_project_id_and_enabled_until: - index_pages_domains_on_project_id diff --git a/spec/support/shared_examples/services/common_system_notes_shared_examples.rb b/spec/support/shared_examples/services/common_system_notes_shared_examples.rb index 1887b38b50e..14b0aa1ab08 100644 --- a/spec/support/shared_examples/services/common_system_notes_shared_examples.rb +++ b/spec/support/shared_examples/services/common_system_notes_shared_examples.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true -RSpec.shared_examples 'system note creation' do |update_params, note_text| - subject { described_class.new(project: project, current_user: user).execute(issuable, old_labels: []) } +RSpec.shared_examples 'system note creation' do |update_params, note_text, is_update = true| + subject do + described_class.new(project: project, current_user: user).execute(issuable, old_labels: [], is_update: is_update) + end before do issuable.assign_attributes(update_params) |