From abe8511b81a9b40cf104959a585b44029be37d0d Mon Sep 17 00:00:00 2001 From: jdettmannnava <145699825+jdettmannnava@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:45:49 -0500 Subject: [PATCH 1/4] refactor compound component --- .../organization/compound_show_component.rb | 10 ++++----- .../compound_show_component_preview.rb | 4 ++-- .../controllers/organizations_controller.rb | 19 ++++++++-------- .../compound_show_component_spec.rb | 8 +++---- .../spec/requests/client_tokens_spec.rb | 22 +++++++++++++++++++ .../spec/requests/organizations_spec.rb | 20 ++++++++--------- 6 files changed, 52 insertions(+), 31 deletions(-) diff --git a/dpc-portal/app/components/page/organization/compound_show_component.rb b/dpc-portal/app/components/page/organization/compound_show_component.rb index 9e44bb1a4d..e6de7002bf 100644 --- a/dpc-portal/app/components/page/organization/compound_show_component.rb +++ b/dpc-portal/app/components/page/organization/compound_show_component.rb @@ -4,15 +4,15 @@ module Page module Organization # Shows tabbed credential delegates and credentials class CompoundShowComponent < ViewComponent::Base - def initialize(organization, cd_invitations, expired_cd_invitations, credential_delegates, show_cds) + def initialize(organization, delegate_information) super @links = [['User Access', '#credential_delegates', true], ['Credentials', '#credentials', false]] @organization = organization - @active_credential_delegates = credential_delegates - @pending_credential_delegates = cd_invitations - @expired_cd_invitations = expired_cd_invitations - @show_cds = show_cds + @active_credential_delegates = delegate_information[:active] + @pending_credential_delegates = delegate_information[:pending] + @expired_cd_invitations = delegate_information[:expired] + @show_cds = !delegate_information.empty? end end end diff --git a/dpc-portal/app/components/page/organization/compound_show_component_preview.rb b/dpc-portal/app/components/page/organization/compound_show_component_preview.rb index 81b37a7dc1..997daf04fe 100644 --- a/dpc-portal/app/components/page/organization/compound_show_component_preview.rb +++ b/dpc-portal/app/components/page/organization/compound_show_component_preview.rb @@ -6,12 +6,12 @@ module Organization class CompoundShowComponentPreview < ViewComponent::Preview def authorized_official org = ProviderOrganization.new(name: 'Health Hut', npi: '1111111111', id: 2) - render(Page::Organization::CompoundShowComponent.new(org, [], [], [], true)) + render(Page::Organization::CompoundShowComponent.new(org, { active: [], pending: [], expired: [] })) end def credential_delegate org = ProviderOrganization.new(name: 'Health Hut', npi: '1111111111', id: 2) - render(Page::Organization::CompoundShowComponent.new(org, [], [], [], false)) + render(Page::Organization::CompoundShowComponent.new(org, {})) end end end diff --git a/dpc-portal/app/controllers/organizations_controller.rb b/dpc-portal/app/controllers/organizations_controller.rb index c42a0cb265..0e29462da7 100644 --- a/dpc-portal/app/controllers/organizations_controller.rb +++ b/dpc-portal/app/controllers/organizations_controller.rb @@ -17,19 +17,18 @@ def index end def show - show_cds = current_user.ao?(@organization) - if show_cds + @delegate_information = {} + if current_user.ao?(@organization) # Invitation expiration is determined in relation to the `created_at` field; the `status` field will # never be `'expired'`. Therefore, we need to further filter out expired invitations from this query. - @pending_invitations = Invitation.where(provider_organization: @organization, - invited_by: current_user, - status: :pending).reject(&:expired?) - @expired_invitations = Invitation.where(provider_organization: @organization, - invited_by: current_user).select(&:expired?) - @cds = CdOrgLink.where(provider_organization: @organization, disabled_at: nil) + @delegate_information[:pending] = Invitation.where(provider_organization: @organization, + invited_by: current_user, + status: :pending).reject(&:expired?) + @delegate_information[:expired] = Invitation.where(provider_organization: @organization, + invited_by: current_user).select(&:expired?) + @delegate_information[:active] = CdOrgLink.where(provider_organization: @organization, disabled_at: nil) end - render(Page::Organization::CompoundShowComponent.new(@organization, @pending_invitations, @expired_invitations, - @cds, show_cds)) + render(Page::Organization::CompoundShowComponent.new(@organization, @delegate_information)) end def new diff --git a/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb b/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb index a52f20ca67..89e34d8d22 100644 --- a/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb +++ b/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb @@ -10,14 +10,14 @@ normalize_space(rendered_content) end let(:org) { build(:provider_organization, name: 'Health Hut', npi: '11111111', id: 2) } - let(:component) { described_class.new(org, [], [], [], show_cds) } + let(:component) { described_class.new(org, delegate_info) } before do render_inline(component) end - context 'show cds' do - let(:show_cds) { true } + context 'has delegate information' do + let(:delegate_info) { { active: [], pending: [], expired: [] } } it 'Should have org name' do is_expected.to include("

#{org.name}

") end @@ -39,7 +39,7 @@ end context 'not show cds' do - let(:show_cds) { false } + let(:delegate_info) { {} } it 'Should have org name' do is_expected.to include("

#{org.name}

") end diff --git a/dpc-portal/spec/requests/client_tokens_spec.rb b/dpc-portal/spec/requests/client_tokens_spec.rb index 3188bdabd8..a7ebcf26c0 100644 --- a/dpc-portal/spec/requests/client_tokens_spec.rb +++ b/dpc-portal/spec/requests/client_tokens_spec.rb @@ -161,6 +161,28 @@ end end + context 'as ao' do + let!(:user) { create(:user) } + let(:org_api_id) { SecureRandom.uuid } + let!(:org) { create(:provider_organization, terms_of_service_accepted_by:, dpc_api_organization_id: org_api_id) } + + before do + create(:ao_org_link, provider_organization: org, user:) + sign_in user + end + + it 'redirects to ' do + token_guid = SecureRandom.uuid + api_client = stub_api_client(message: :get_organization, + response: default_get_org_response(org_api_id)) + stub_self_returning_api_client(message: :create_client_token, + response: default_get_client_tokens(guid: token_guid)['entities'].first, + api_client:) + post "/organizations/#{org.id}/client_tokens", params: { label: 'New Token' } + expect(assigns(:organization)).to eq org + expect(assigns(:client_token)['id']).to eq token_guid + end + end context 'as cd' do let!(:user) { create(:user) } let(:org_api_id) { SecureRandom.uuid } diff --git a/dpc-portal/spec/requests/organizations_spec.rb b/dpc-portal/spec/requests/organizations_spec.rb index e487341ffd..7921e9948c 100644 --- a/dpc-portal/spec/requests/organizations_spec.rb +++ b/dpc-portal/spec/requests/organizations_spec.rb @@ -267,24 +267,24 @@ it 'assigns if exist' do create(:invitation, :cd, provider_organization: org, invited_by: user) get "/organizations/#{org.id}" - expect(assigns(:pending_invitations).size).to eq 1 + expect(assigns(:delegate_information)[:pending].size).to eq 1 end it 'does not assign if not exist' do get "/organizations/#{org.id}" - expect(assigns(:pending_invitations).size).to eq 0 + expect(assigns(:delegate_information)[:pending].size).to eq 0 end it 'does not assign if only accepted exists' do create(:invitation, :cd, provider_organization: org, invited_by: user, status: :accepted) get "/organizations/#{org.id}" - expect(assigns(:pending_invitations).size).to eq 0 + expect(assigns(:delegate_information)[:pending].size).to eq 0 end it 'does not assign if expired' do create(:invitation, :cd, provider_organization: org, invited_by: user, created_at: 3.days.ago) get "/organizations/#{org.id}" - expect(assigns(:pending_invitations).size).to eq 0 + expect(assigns(:delegate_information)[:pending].size).to eq 0 end end @@ -292,18 +292,18 @@ it 'assigns if exist' do create(:invitation, :cd, provider_organization: org, invited_by: user, created_at: 3.days.ago) get "/organizations/#{org.id}" - expect(assigns(:expired_invitations).size).to eq 1 + expect(assigns(:delegate_information)[:expired].size).to eq 1 end it 'does not assign if not exist' do get "/organizations/#{org.id}" - expect(assigns(:pending_invitations).size).to eq 0 + expect(assigns(:delegate_information)[:pending].size).to eq 0 end it 'does not assign if invitation is not expired' do create(:invitation, :cd, provider_organization: org, invited_by: user) get "/organizations/#{org.id}" - expect(assigns(:expired_invitations).size).to eq 0 + expect(assigns(:delegate_information)[:expired].size).to eq 0 end end @@ -311,18 +311,18 @@ it 'assigns if exist' do create(:cd_org_link, provider_organization: org) get "/organizations/#{org.id}" - expect(assigns(:cds).size).to eq 1 + expect(assigns(:delegate_information)[:active].size).to eq 1 end it 'does not assign if not exist' do get "/organizations/#{org.id}" - expect(assigns(:cds).size).to eq 0 + expect(assigns(:delegate_information)[:active].size).to eq 0 end it 'does not assign if link disabled' do create(:cd_org_link, provider_organization: org, disabled_at: 1.day.ago) get "/organizations/#{org.id}" - expect(assigns(:cds).size).to eq 0 + expect(assigns(:delegate_information)[:active].size).to eq 0 end end end From 9ca3a6874686059679a0e1de09be1b30c12dcdd5 Mon Sep 17 00:00:00 2001 From: jdettmannnava <145699825+jdettmannnava@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:33:54 -0500 Subject: [PATCH 2/4] add param to redirects --- .../show_token_component.html.erb | 2 +- .../organization/compound_show_component.rb | 6 +-- .../controllers/ip_addresses_controller.rb | 4 +- .../controllers/organizations_controller.rb | 3 +- .../app/controllers/public_keys_controller.rb | 4 +- .../client_token/show_token_component_spec.rb | 2 +- .../compound_show_component_spec.rb | 49 ++++++++++++------- .../spec/requests/client_tokens_spec.rb | 22 --------- dpc-portal/spec/requests/ip_addresses_spec.rb | 5 +- .../spec/requests/organizations_spec.rb | 14 ++++++ dpc-portal/spec/requests/public_keys_spec.rb | 4 +- 11 files changed, 62 insertions(+), 53 deletions(-) diff --git a/dpc-portal/app/components/page/client_token/show_token_component.html.erb b/dpc-portal/app/components/page/client_token/show_token_component.html.erb index bb832bacf8..8bfccddf81 100644 --- a/dpc-portal/app/components/page/client_token/show_token_component.html.erb +++ b/dpc-portal/app/components/page/client_token/show_token_component.html.erb @@ -1,5 +1,5 @@
-
← <%= link_to organization.name, organization_path(organization.path_id) %>
+
← <%= link_to organization.name, organization_path(organization, credential_start: :true) %>

Client token created

"<%= client_token['label'] %>" created for <%= organization.name %>

diff --git a/dpc-portal/app/components/page/organization/compound_show_component.rb b/dpc-portal/app/components/page/organization/compound_show_component.rb index e6de7002bf..72b935a281 100644 --- a/dpc-portal/app/components/page/organization/compound_show_component.rb +++ b/dpc-portal/app/components/page/organization/compound_show_component.rb @@ -4,10 +4,10 @@ module Page module Organization # Shows tabbed credential delegates and credentials class CompoundShowComponent < ViewComponent::Base - def initialize(organization, delegate_information) + def initialize(organization, delegate_information, credential_start) super - @links = [['User Access', '#credential_delegates', true], - ['Credentials', '#credentials', false]] + @links = [['User Access', '#credential_delegates', !credential_start], + ['Credentials', '#credentials', credential_start]] @organization = organization @active_credential_delegates = delegate_information[:active] @pending_credential_delegates = delegate_information[:pending] diff --git a/dpc-portal/app/controllers/ip_addresses_controller.rb b/dpc-portal/app/controllers/ip_addresses_controller.rb index cac6f61db9..cd0b119909 100644 --- a/dpc-portal/app/controllers/ip_addresses_controller.rb +++ b/dpc-portal/app/controllers/ip_addresses_controller.rb @@ -19,7 +19,7 @@ def create if new_ip_address[:response] log_credential_action(:ip_address, new_ip_address.dig(:message, 'id'), :add) flash[:notice] = 'IP address successfully created.' - redirect_to organization_path(@organization) + redirect_to organization_path(@organization, credential_start: true) else @errors = new_ip_address[:errors] || {} flash[:alert] = @errors[:root] || 'IP address invalid' @@ -35,7 +35,7 @@ def destroy else flash[:alert] = manager.errors[:root] || 'IP address could not be deleted.' end - redirect_to organization_path(@organization) + redirect_to organization_path(@organization, credential_start: true) end # rubocop:enable Metrics/AbcSize end diff --git a/dpc-portal/app/controllers/organizations_controller.rb b/dpc-portal/app/controllers/organizations_controller.rb index 0e29462da7..a21bfe254c 100644 --- a/dpc-portal/app/controllers/organizations_controller.rb +++ b/dpc-portal/app/controllers/organizations_controller.rb @@ -28,7 +28,8 @@ def show invited_by: current_user).select(&:expired?) @delegate_information[:active] = CdOrgLink.where(provider_organization: @organization, disabled_at: nil) end - render(Page::Organization::CompoundShowComponent.new(@organization, @delegate_information)) + render(Page::Organization::CompoundShowComponent.new(@organization, @delegate_information, + params[:credential_start])) end def new diff --git a/dpc-portal/app/controllers/public_keys_controller.rb b/dpc-portal/app/controllers/public_keys_controller.rb index 53e931c9ce..0594c3a52d 100644 --- a/dpc-portal/app/controllers/public_keys_controller.rb +++ b/dpc-portal/app/controllers/public_keys_controller.rb @@ -25,7 +25,7 @@ def create if new_public_key[:response] log_credential_action(:public_key, new_public_key.dig(:message, 'id'), :add) flash[:notice] = 'Public key successfully created.' - redirect_to organization_path(@organization) + redirect_to organization_path(@organization, credential_start: true) else @errors = new_public_key[:errors] render_error @errors[:root] || 'Invalid encoding' @@ -38,7 +38,7 @@ def destroy if manager.delete_public_key(params) log_credential_action(:public_key, params[:id], :remove) flash[:notice] = 'Public key successfully deleted.' - redirect_to organization_path(@organization) + redirect_to organization_path(@organization, credential_start: true) else flash[:alert] = 'Public key could not be deleted.' end diff --git a/dpc-portal/spec/components/page/client_token/show_token_component_spec.rb b/dpc-portal/spec/components/page/client_token/show_token_component_spec.rb index edcb85dc96..3b62e04db2 100644 --- a/dpc-portal/spec/components/page/client_token/show_token_component_spec.rb +++ b/dpc-portal/spec/components/page/client_token/show_token_component_spec.rb @@ -16,7 +16,7 @@ let(:expected_html) do <<~HTML
- +

Client token created

"Your token" created for #{org.name}

diff --git a/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb b/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb index 89e34d8d22..6c3700ac90 100644 --- a/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb +++ b/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb @@ -10,7 +10,7 @@ normalize_space(rendered_content) end let(:org) { build(:provider_organization, name: 'Health Hut', npi: '11111111', id: 2) } - let(:component) { described_class.new(org, delegate_info) } + let(:component) { described_class.new(org, delegate_info, credential_start) } before do render_inline(component) @@ -18,28 +18,43 @@ context 'has delegate information' do let(:delegate_info) { { active: [], pending: [], expired: [] } } - it 'Should have org name' do - is_expected.to include("

#{org.name}

") - end - it 'Should have npi' do - is_expected.to include(%(
NPI: #{org.npi}
)) + context 'credential delegate start' do + let(:credential_start) { false } + it 'Should have org name' do + is_expected.to include("

#{org.name}

") + end + it 'Should have npi' do + is_expected.to include(%(
NPI: #{org.npi}
)) + end + it 'Should have script tag' do + is_expected.to include('') + end + it 'Should have credentials' do + is_expected.to include('
') + end + it 'Should start on credential delegate page' do + is_expected.to include('}make_current(0);') + is_expected.to_not include('}make_current(1);') + end end - it 'Should have script tag' do - is_expected.to include('') - end - it 'Should have credentials' do - is_expected.to include('
') + context 'credential start' do + let(:credential_start) { true } + it 'Should start on credential page' do + is_expected.to_not include('}make_current(0);') + is_expected.to include('}make_current(1);') + end end end context 'not show cds' do let(:delegate_info) { {} } + let(:credential_start) { true } it 'Should have org name' do is_expected.to include("

#{org.name}

") end diff --git a/dpc-portal/spec/requests/client_tokens_spec.rb b/dpc-portal/spec/requests/client_tokens_spec.rb index a7ebcf26c0..3188bdabd8 100644 --- a/dpc-portal/spec/requests/client_tokens_spec.rb +++ b/dpc-portal/spec/requests/client_tokens_spec.rb @@ -161,28 +161,6 @@ end end - context 'as ao' do - let!(:user) { create(:user) } - let(:org_api_id) { SecureRandom.uuid } - let!(:org) { create(:provider_organization, terms_of_service_accepted_by:, dpc_api_organization_id: org_api_id) } - - before do - create(:ao_org_link, provider_organization: org, user:) - sign_in user - end - - it 'redirects to ' do - token_guid = SecureRandom.uuid - api_client = stub_api_client(message: :get_organization, - response: default_get_org_response(org_api_id)) - stub_self_returning_api_client(message: :create_client_token, - response: default_get_client_tokens(guid: token_guid)['entities'].first, - api_client:) - post "/organizations/#{org.id}/client_tokens", params: { label: 'New Token' } - expect(assigns(:organization)).to eq org - expect(assigns(:client_token)['id']).to eq token_guid - end - end context 'as cd' do let!(:user) { create(:user) } let(:org_api_id) { SecureRandom.uuid } diff --git a/dpc-portal/spec/requests/ip_addresses_spec.rb b/dpc-portal/spec/requests/ip_addresses_spec.rb index 44738cbe88..65dcb415c6 100644 --- a/dpc-portal/spec/requests/ip_addresses_spec.rb +++ b/dpc-portal/spec/requests/ip_addresses_spec.rb @@ -178,6 +178,7 @@ response: default_get_ip_addresses['entities'].first, api_client:) post "/organizations/#{org.id}/ip_addresses", params: { label: 'Public IP 1', ip_address: '136.226.19.87' } + expect(response).to redirect_to(organization_path(org, credential_start: true)) expect(assigns(:organization)).to eq org end @@ -258,7 +259,7 @@ api_client:) delete "/organizations/#{org.id}/ip_addresses/#{addr_guid}" expect(flash[:notice]).to eq('IP address successfully deleted.') - expect(response).to redirect_to(organization_path(org)) + expect(response).to redirect_to(organization_path(org, credential_start: true)) end it 'renders error if error' do @@ -272,7 +273,7 @@ api_client:) delete "/organizations/#{org.id}/ip_addresses/#{addr_guid}" expect(flash[:alert]).to eq('IP address could not be deleted.') - expect(response).to redirect_to(organization_path(org)) + expect(response).to redirect_to(organization_path(org, credential_start: true)) end end end diff --git a/dpc-portal/spec/requests/organizations_spec.rb b/dpc-portal/spec/requests/organizations_spec.rb index 7921e9948c..7c042266a3 100644 --- a/dpc-portal/spec/requests/organizations_spec.rb +++ b/dpc-portal/spec/requests/organizations_spec.rb @@ -255,6 +255,20 @@ expect(assigns(:organization)).to eq org end + it 'should show cd list by default' do + get "/organizations/#{org.id}" + expect(response).to be_ok + expect(response.body).to include(' make_current(0);') + expect(response.body).to_not include(' make_current(1);') + end + + it 'should show creds if credential_start param' do + get "/organizations/#{org.id}", params: { credential_start: true } + expect(response).to be_ok + expect(response.body).to_not include(' make_current(0);') + expect(response.body).to include(' make_current(1);') + end + it 'shows CD list page' do get "/organizations/#{org.id}" expect(response.body).to include('

Credential delegates

') diff --git a/dpc-portal/spec/requests/public_keys_spec.rb b/dpc-portal/spec/requests/public_keys_spec.rb index f2bc83150b..6146692c88 100644 --- a/dpc-portal/spec/requests/public_keys_spec.rb +++ b/dpc-portal/spec/requests/public_keys_spec.rb @@ -188,7 +188,7 @@ } expect(flash[:notice]).to eq('Public key successfully created.') expect(assigns(:organization)).to eq org - expect(response).to redirect_to(organization_path(org)) + expect(response).to redirect_to(organization_path(org, credential_start: true)) end it 'fails if missing params' do @@ -257,7 +257,7 @@ api_client:) delete "/organizations/#{org.id}/public_keys/#{key_guid}" expect(flash[:notice]).to eq('Public key successfully deleted.') - expect(response).to redirect_to(organization_path(org)) + expect(response).to redirect_to(organization_path(org, credential_start: true)) end it 'renders error if error' do From 2784f6db6f747e5996e417da0164ae4dfbcbf96c Mon Sep 17 00:00:00 2001 From: jdettmannnava <145699825+jdettmannnava@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:58:47 -0500 Subject: [PATCH 3/4] drive by bugfix --- dpc-portal/app/models/invitation.rb | 2 +- dpc-portal/spec/models/invitation_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dpc-portal/app/models/invitation.rb b/dpc-portal/app/models/invitation.rb index 6bf0dfae5f..3dccac65f5 100644 --- a/dpc-portal/app/models/invitation.rb +++ b/dpc-portal/app/models/invitation.rb @@ -31,7 +31,7 @@ def invited_by_full_name end def expired? - Time.now > expiration_date + pending? && Time.now > expiration_date end def expired_at diff --git a/dpc-portal/spec/models/invitation_spec.rb b/dpc-portal/spec/models/invitation_spec.rb index 0368d89221..eca2a9a8a7 100644 --- a/dpc-portal/spec/models/invitation_spec.rb +++ b/dpc-portal/spec/models/invitation_spec.rb @@ -155,6 +155,10 @@ invitation = create(:invitation, :cd, created_at: 2.days.ago) expect(invitation.expired?).to eq true end + it 'should not be expired if acccepted and more than 2 days old' do + invitation = create(:invitation, :cd, created_at: 49.hours.ago, status: :accepted) + expect(invitation.expired?).to eq false + end end describe :accept! do From 95a1ae5cefcb0487dfa51b2821df40594ea3957d Mon Sep 17 00:00:00 2001 From: jdettmannnava <145699825+jdettmannnava@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:09:13 -0500 Subject: [PATCH 4/4] better spec names --- .../page/organization/compound_show_component_spec.rb | 4 ++-- dpc-portal/spec/requests/organizations_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb b/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb index 6c3700ac90..a28dd67ad6 100644 --- a/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb +++ b/dpc-portal/spec/components/page/organization/compound_show_component_spec.rb @@ -16,7 +16,7 @@ render_inline(component) end - context 'has delegate information' do + context 'cd tab' do let(:delegate_info) { { active: [], pending: [], expired: [] } } context 'credential delegate start' do let(:credential_start) { false } @@ -52,7 +52,7 @@ end end - context 'not show cds' do + context 'credentials tab' do let(:delegate_info) { {} } let(:credential_start) { true } it 'Should have org name' do diff --git a/dpc-portal/spec/requests/organizations_spec.rb b/dpc-portal/spec/requests/organizations_spec.rb index 7c042266a3..6288923ede 100644 --- a/dpc-portal/spec/requests/organizations_spec.rb +++ b/dpc-portal/spec/requests/organizations_spec.rb @@ -255,14 +255,14 @@ expect(assigns(:organization)).to eq org end - it 'should show cd list by default' do + it 'should start on cd tab by default' do get "/organizations/#{org.id}" expect(response).to be_ok expect(response.body).to include(' make_current(0);') expect(response.body).to_not include(' make_current(1);') end - it 'should show creds if credential_start param' do + it 'should start on credentials tab if credential_start param' do get "/organizations/#{org.id}", params: { credential_start: true } expect(response).to be_ok expect(response.body).to_not include(' make_current(0);')