diff options
author | Akihiko Odaki (@fn_aki@pawoo.net) <akihiko.odaki.4i@stu.hosei.ac.jp> | 2017-06-05 00:07:39 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-04 17:07:39 +0200 |
commit | 42844df966d7f503321c82a1f04a8a9be0210dbf (patch) | |
tree | 887c745bc9021d2378f8de52d279aeffd9978a4f /spec/models | |
parent | b0fe58dc699fd1b2de61b54b8e884783f742c664 (diff) |
Spec ScopedSettings (#3559)
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d7ca91e81..735c78c64 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -41,37 +41,6 @@ RSpec.describe User, type: :model do end end - describe 'settings' do - it 'inherits default settings from default yml' do - expect(Setting.boost_modal).to eq false - expect(Setting.interactions['must_be_follower']).to eq false - - user = User.new - expect(user.settings.boost_modal).to eq false - expect(user.settings.interactions['must_be_follower']).to eq false - end - - it 'can update settings' do - user = Fabricate(:user) - expect(user.settings['interactions']['must_be_follower']).to eq false - user.settings['interactions'] = user.settings['interactions'].merge('must_be_follower' => true) - user.reload - - expect(user.settings['interactions']['must_be_follower']).to eq true - end - - xit 'does not mutate defaults via the cache' do - user = Fabricate(:user) - user.settings['interactions']['must_be_follower'] = true - # TODO - # This mutates the global settings default such that future user - # instances will inherit the incorrect starting values - - other = Fabricate(:user) - expect(other.settings['interactions']['must_be_follower']).to eq false - end - end - describe 'scopes' do describe 'recent' do it 'returns an array of recent users ordered by id' do @@ -285,4 +254,14 @@ RSpec.describe User, type: :model do end end end + + it_behaves_like 'Settings-extended' do + def create! + User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234' ) + end + + def fabricate + Fabricate(:user) + end + end end |