Fix Setting.user_format leaking

pull/4995/head
Oliver Günther 8 years ago
parent b43fe9fa34
commit e3e2749165
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 13
      spec/models/timeline_spec.rb

@ -31,15 +31,16 @@ require 'spec_helper'
describe Timeline, type: :model do
describe 'helper methods for creation' do
describe 'available_responsibles' do
it 'is sorted according to general setting' do
ab = FactoryGirl.create(:user, firstname: 'a', lastname: 'b')
ba = FactoryGirl.create(:user, firstname: 'b', lastname: 'a')
t = Timeline.new
Setting.user_format = :firstname_lastname
let!(:ab) { FactoryGirl.create(:user, firstname: 'a', lastname: 'b') }
let!(:ba) { FactoryGirl.create(:user, firstname: 'b', lastname: 'a') }
let!(:t) { Timeline.new }
it 'sorted by firstname_lastname', with_settings: { user_format: :firstname_lastname } do
expect(t.available_responsibles).to eq([ab, ba])
end
Setting.user_format = :lastname_firstname
it 'sorted by lastname_firstname', with_settings: { user_format: :lastname_firstname } do
expect(t.available_responsibles).to eq([ba, ab])
end
end

Loading…
Cancel
Save