OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec/models/custom_style_spec.rb

30 lines
680 B

require 'spec_helper'
RSpec.describe CustomStyle, type: :model do
describe "#current" do
subject { CustomStyle.current }
context "there is one in DB" do
it 'returns an instance' do
CustomStyle.create
expect(subject).to be_a CustomStyle
end
it 'returns the same instance for subsequent calls' do
CustomStyle.create
first_instance = CustomStyle.current
expect(subject).to be first_instance
end
end
context "there is none in DB" do
8 years ago
before do
RequestStore.delete(:current_custom_style)
end
it 'returns nil' do
expect(subject).to be nil
end
end
end
end