docbrown/spec/initializers/application_config_spec.rb
dependabot[bot] f24d3d157f
Bump rubocop-rails from 2.10.1 to 2.11.0 (#14043)
* Bump rubocop-rails from 2.10.1 to 2.11.0

Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.10.1...v2.11.0)

---
updated-dependencies:
- dependency-name: rubocop-rails
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Enable new cops and fix violations

* Remove expected string literal

As we're passing a block (that yields a string) there are no arguments
to the debug call.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Dan Uber <dan@forem.com>
2021-06-22 11:25:28 -05:00

41 lines
1 KiB
Ruby

require "rails_helper"
describe ApplicationConfig do
it "logs warning if key is not found" do
allow(Rails.logger).to receive(:debug)
described_class["missing"]
expect(Rails.logger).to have_received(:debug)
end
describe ".app_domain_no_port" do
it "handles plain subdomain only name" do
setup_app_domain("renner")
expect(described_class.app_domain_no_port).to eq "renner"
end
it "handles plain domain name" do
setup_app_domain("renner.ngrok.io")
expect(described_class.app_domain_no_port).to eq "renner.ngrok.io"
end
it "handles domain with port" do
setup_app_domain("renner:3000")
expect(described_class.app_domain_no_port).to eq "renner"
end
it "handles domain with schema and port" do
setup_app_domain("http://renner:4000")
expect(described_class.app_domain_no_port).to eq "renner"
end
private
def setup_app_domain(app_domain)
allow(ApplicationConfig).to receive(:[]).with("APP_DOMAIN").and_return(app_domain)
end
end
end