docbrown/spec/requests/admin/admin_portals_spec.rb
Ridhwana ebfe0ead2d
Add application deployment information to the admin page (#12149)
* WIP: release footprint in the admin UI

* feat: show the commit ID and the date

* chore: change env optional to empty string

* fix: change the FOREM_BUILD_DATE to RELEASE_FOOTPRINT

* feat: add Not Available as a last option

* test: last deployed time and latest commit id

* feat: update the way we change the env variable!

* fix: we need to set the RELEASE FOOTPRINT so that this clause is not hit - `return path if release_footprint.blank?`
2021-01-08 16:36:12 +02:00

43 lines
1.2 KiB
Ruby

require "rails_helper"
RSpec.describe "/admin", type: :request do
let(:super_admin) { create(:user, :super_admin) }
before { sign_in super_admin }
describe "profile admin feature flag" do
it "shows the option when the feature flag is enabled" do
allow(FeatureFlag).to receive(:enabled?).with(:profile_admin).and_return(true)
get admin_path
expect(response.body).to include("Config: Profile Setup")
end
it "does not show the option when the feature flag is disabled" do
allow(FeatureFlag).to receive(:enabled?).with(:profile_admin).and_return(false)
get admin_path
expect(response.body).not_to include("Config: Profile Setup")
end
end
describe "Last deployed and Lastest Commit ID card" do
it "shows 'Not Available' if the Last deployed time is missing" do
stub_const("ENV", ENV.to_h.merge("HEROKU_RELEASE_CREATED_AT" => ""))
get admin_path
expect(response.body).to include("Not Available")
end
it "shows the correct value if the Last deployed time is available" do
stub_const("ENV", ENV.to_h.merge("HEROKU_RELEASE_CREATED_AT" => "Some date"))
get admin_path
expect(response.body).to include(ENV["HEROKU_RELEASE_CREATED_AT"])
end
end
end