Skip to content

Commit

Permalink
Change expect so it doesn't clash with CI settings envs
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Oct 24, 2024
1 parent 9a4332b commit f8d6d55
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions spec/helpers/frontend_asset_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@

RSpec.describe FrontendAssetHelper do
describe "#include_frontend_assets" do
context "when in development or test",
with_env: { "OPENPROJECT_DISABLE_DEV_ASSET_PROXY" => nil } do
before do
allow(Rails.env).to receive(:production?).and_return(false)
end
before do
allow(FrontendAssetHelper).to receive(:assets_proxied?).and_return(proxied)

Check notice on line 34 in spec/helpers/frontend_asset_helper_spec.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] spec/helpers/frontend_asset_helper_spec.rb#L34 <RSpec/DescribedClass>

Use `described_class` instead of `FrontendAssetHelper`.
Raw output
spec/helpers/frontend_asset_helper_spec.rb:34:13: C: RSpec/DescribedClass: Use `described_class` instead of `FrontendAssetHelper`.
end

context "when proxied" do
let(:proxied) { true }

it "returns the proxied frontend server" do
expect(helper.include_frontend_assets).to match(%r{script src="http://(frontend-test|localhost):4200/assets/frontend/main(.*).js"})
Expand All @@ -51,10 +52,8 @@
end
end

context "when in production" do
before do
allow(Rails.env).to receive(:production?).and_return(true)
end
context "when not proxied" do
let(:proxied) { false }

it "returns the path to the asset" do
expect(helper.include_frontend_assets).to match(%r{script src="/assets/frontend/main(.*).js"})
Expand Down

0 comments on commit f8d6d55

Please sign in to comment.