Sha256: a44fe347e96c66e6bec9c433a3fecb598f81444142fe5deba751c93e39838cbd
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe "Serialization" do let!(:user) do User.create! :name => 'Mr. White' do |user| user.settings(:dashboard).theme = 'white' user.settings(:calendar).scope = 'all' end end describe 'created settings' do it 'should be serialized' do user.reload dashboard_settings = user.setting_objects.where(:var => 'dashboard').first calendar_settings = user.setting_objects.where(:var => 'calendar').first expect(dashboard_settings.var).to eq('dashboard') expect(dashboard_settings.value).to eq({'theme' => 'white'}) expect(calendar_settings.var).to eq('calendar') expect(calendar_settings.value).to eq({'scope' => 'all'}) end end describe 'updated settings' do it 'should be serialized' do user.settings(:dashboard).update_attributes! :smart => true dashboard_settings = user.setting_objects.where(:var => 'dashboard').first calendar_settings = user.setting_objects.where(:var => 'calendar').first expect(dashboard_settings.var).to eq('dashboard') expect(dashboard_settings.value).to eq({'theme' => 'white', 'smart' => true}) expect(calendar_settings.var).to eq('calendar') expect(calendar_settings.value).to eq({'scope' => 'all'}) end end end
Version data entries
4 entries across 4 versions & 1 rubygems