Sha256: 642285aa2063048c46c134f73c2cb342bd2a3ed321304e4d39b6bf7747227fcd
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe "Serialization" do let!(:user) do User.create! :name => 'Mr. White' do |user| user.properties(:dashboard).theme = 'white' user.properties(:calendar).scope = 'all' end end describe 'created properties' do it 'should be serialized' do user.reload dashboard_properties = user.property_objects.where(:var => 'dashboard').first calendar_properties = user.property_objects.where(:var => 'calendar').first expect(dashboard_properties.var).to eq('dashboard') expect(dashboard_properties.value).to eq({'theme' => 'white'}) expect(calendar_properties.var).to eq('calendar') expect(calendar_properties.value).to eq({'scope' => 'all'}) end end describe 'updated properties' do it 'should be serialized' do user.properties(:dashboard).update_attributes! :smart => true dashboard_properties = user.property_objects.where(:var => 'dashboard').first calendar_properties = user.property_objects.where(:var => 'calendar').first expect(dashboard_properties.var).to eq('dashboard') expect(dashboard_properties.value).to eq({'theme' => 'white', 'smart' => true}) expect(calendar_properties.var).to eq('calendar') expect(calendar_properties.value).to eq({'scope' => 'all'}) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-properties-3.4.3 | spec/serialize_spec.rb |