mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 08:43:38 +08:00
36 lines
907 B
Ruby
36 lines
907 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
RSpec.describe ProblemCheck::RailsEnv do
|
||
|
subject(:check) { described_class.new }
|
||
|
|
||
|
describe ".call" do
|
||
|
before { Rails.stubs(env: ActiveSupport::StringInquirer.new(environment)) }
|
||
|
|
||
|
context "when running in production environment" do
|
||
|
let(:environment) { "production" }
|
||
|
|
||
|
it { expect(check).to be_chill_about_it }
|
||
|
end
|
||
|
|
||
|
context "when running in development environment" do
|
||
|
let(:environment) { "development" }
|
||
|
|
||
|
it do
|
||
|
expect(check).to have_a_problem.with_priority("low").with_message(
|
||
|
"Your server is running in development mode.",
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when running in test environment" do
|
||
|
let(:environment) { "test" }
|
||
|
|
||
|
it do
|
||
|
expect(check).to have_a_problem.with_priority("low").with_message(
|
||
|
"Your server is running in test mode.",
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|