mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 21:33:38 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
26 lines
1.1 KiB
Ruby
26 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Onebox::DomainChecker do
|
|
describe '.is_blocked?' do
|
|
before do
|
|
SiteSetting.blocked_onebox_domains = "api.cat.org|kitten.cloud"
|
|
end
|
|
|
|
describe "returns true when entirely matched" do
|
|
it { expect(described_class.is_blocked?("api.cat.org")).to be(true) }
|
|
it { expect(described_class.is_blocked?("kitten.cloud")).to be(true) }
|
|
it { expect(described_class.is_blocked?("api.dog.org")).to be(false) }
|
|
it { expect(described_class.is_blocked?("puppy.cloud")).to be(false) }
|
|
end
|
|
|
|
describe "returns true when ends with .<domain>" do
|
|
it { expect(described_class.is_blocked?("dev.api.cat.org")).to be(true) }
|
|
it { expect(described_class.is_blocked?(".api.cat.org")).to be(true) }
|
|
it { expect(described_class.is_blocked?("dev.kitten.cloud")).to be(true) }
|
|
it { expect(described_class.is_blocked?(".kitten.cloud")).to be(true) }
|
|
it { expect(described_class.is_blocked?("xapi.cat.org")).to be(false) }
|
|
it { expect(described_class.is_blocked?("xkitten.cloud")).to be(false) }
|
|
end
|
|
end
|
|
end
|