mirror of
https://github.com/discourse/discourse.git
synced 2024-12-30 07:03:47 +08:00
30 lines
733 B
Ruby
30 lines
733 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
RSpec.describe ProblemCheck::Ram do
|
||
|
subject(:check) { described_class.new }
|
||
|
|
||
|
before { MemInfo.any_instance.stubs(mem_total: total_ram) }
|
||
|
|
||
|
context "when total ram is 1 GB" do
|
||
|
let(:total_ram) { 1_025_272 }
|
||
|
|
||
|
it { expect(check).to be_chill_about_it }
|
||
|
end
|
||
|
|
||
|
context "when total ram cannot be determined" do
|
||
|
let(:total_ram) { nil }
|
||
|
|
||
|
it { expect(check).to be_chill_about_it }
|
||
|
end
|
||
|
|
||
|
context "when total ram is less than 1 GB" do
|
||
|
let(:total_ram) { 512_636 }
|
||
|
|
||
|
it do
|
||
|
expect(check).to have_a_problem.with_priority("low").with_message(
|
||
|
"Your server is running with less than 1 GB of total memory. At least 1 GB of memory is recommended.",
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
end
|