2019-12-20 09:24:38 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
require Rails.root.join('db', 'migrate', '20191213120427_fix_max_pages_size.rb')
|
|
|
|
|
2020-03-11 21:09:19 +00:00
|
|
|
describe FixMaxPagesSize do
|
2019-12-20 09:24:38 +00:00
|
|
|
let(:application_settings) { table(:application_settings) }
|
|
|
|
let!(:default_setting) { application_settings.create! }
|
|
|
|
let!(:max_possible_setting) { application_settings.create!(max_pages_size: described_class::MAX_SIZE) }
|
|
|
|
let!(:higher_than_maximum_setting) { application_settings.create!(max_pages_size: described_class::MAX_SIZE + 1) }
|
|
|
|
|
|
|
|
it 'correctly updates settings only if needed' do
|
|
|
|
migrate!
|
|
|
|
|
|
|
|
expect(default_setting.reload.max_pages_size).to eq(100)
|
|
|
|
expect(max_possible_setting.reload.max_pages_size).to eq(described_class::MAX_SIZE)
|
|
|
|
expect(higher_than_maximum_setting.reload.max_pages_size).to eq(described_class::MAX_SIZE)
|
|
|
|
end
|
|
|
|
end
|