docbrown/spec/models/site_config_spec.rb
rhymes 10efa25c0a
Add missing presence validators to models (#10495)
* Add missing presence validator for Tag

* Add missing presence validators to Follow

* Add missing presence validators to ProfileField

* Add missing presence validators to Comment

* Add missing presence validators to Profile

* Add missing presence validators to Organization

* Add missing presence validators to Badge

* Add missing presence validators to Webhook::Endpoint

* Add missing presence validators to NotificationSubscription

* Add missing presence validators to PodcastEpisode

* Add missing presence validators to Sponsorship

* Add missing presence validators to PollOption

* Add missing presence validators to Poll

* Add missing presence validators to Article

* Add missing presence validators to EmailAuthorization

* Add missing presence validators to AuditLog

* Add missing presence validators to DataUpdateScript

* Add missing presence validators to User

* Add missing presence validators to SiteConfig

* Fix specs
2020-10-01 16:15:32 +02:00

23 lines
650 B
Ruby

require "rails_helper"
RSpec.describe SiteConfig, type: :model do
describe "validations" do
describe "builtin validations" do
it { is_expected.to validate_presence_of(:var) }
end
end
describe ".local?" do
it "returns true if the .app_domain points to localhost" do
allow(described_class).to receive(:app_domain).and_return("localhost:3000")
expect(described_class.local?).to be(true)
end
it "returns false if the .app_domain points to a regular domain" do
allow(described_class).to receive(:app_domain).and_return("forem.dev")
expect(described_class.local?).to be(false)
end
end
end