Skip to content

Commit

Permalink
Address CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Dec 18, 2024
1 parent f00f051 commit f0fce0e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
RSpec.describe "Edit project stages and gates on project overview page", :js, :with_cuprite,
with_flag: { stages_and_gates: true } do
include_context "with seeded projects and stages and gates"
let(:user) { create(:user) }
shared_let(:user) { create(:user) }
let(:overview_page) { Pages::Projects::Show.new(project) }
let(:permissions) { [] }

current_user { user }

before do
allow(User).to receive(:current).and_return user
mock_permissions_for(user) do |mock|
mock.allow_in_project(*permissions, project:) # any project
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

let(:overview_page) { Pages::Projects::Show.new(project) }

current_user { admin }

before do
# TODO: Could this work for all feature specs?
allow(User).to receive(:current).and_return admin
overview_page.visit_page
end

Expand Down
48 changes: 23 additions & 25 deletions spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@

let(:overview_page) { Pages::Projects::Show.new(project) }

before do
login_as admin
end
current_user { admin }

it "does show the sidebar" do
overview_page.visit_page
Expand Down Expand Up @@ -66,35 +64,35 @@
overview_page.visit_page

overview_page.within_life_cycles_sidebar do
fields = page.all(".op-project-life-cycle-container")

expect(fields.size).to eq(7)

expect(fields[0].text).to include("Initiating")
expect(fields[1].text).to include("Ready for Planning")
expect(fields[2].text).to include("Planning")
expect(fields[3].text).to include("Ready for Executing")
expect(fields[4].text).to include("Executing")
expect(fields[5].text).to include("Ready for Closing")
expect(fields[6].text).to include("Closing")
expected_stages = [
"Initiating",
"Ready for Planning",
"Planning",
"Ready for Executing",
"Executing",
"Ready for Closing",
"Closing"
]
fields = page.all(".op-project-life-cycle-container > div:first-child")
expect(fields.map(&:text)).to eq(expected_stages)
end

life_cycle_ready_for_executing_definition.move_to_bottom

overview_page.visit_page

overview_page.within_life_cycles_sidebar do
fields = page.all(".op-project-life-cycle-container")

expect(fields.size).to eq(7)

expect(fields[0].text).to include("Initiating")
expect(fields[1].text).to include("Ready for Planning")
expect(fields[2].text).to include("Planning")
expect(fields[3].text).to include("Executing")
expect(fields[4].text).to include("Ready for Closing")
expect(fields[5].text).to include("Closing")
expect(fields[6].text).to include("Ready for Executing")
expected_stages = [
"Initiating",
"Ready for Planning",
"Planning",
"Executing",
"Ready for Closing",
"Closing",
"Ready for Executing"
]
fields = page.all(".op-project-life-cycle-container > div:first-child")
expect(fields.map(&:text)).to eq(expected_stages)
end
end

Expand Down

0 comments on commit f0fce0e

Please sign in to comment.