Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Add specs for reloading with different resources containing the data
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Jun 12, 2009
1 parent 41335e7 commit 0cd150e
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions spec/public/shared/resource_shared_spec.rb
Expand Up @@ -423,18 +423,38 @@

describe '#reload' do

before :all do
rescue_if 'TODO', @skip do
@user.name = 'dkubb'
@user.description = 'test'
@user.reload
describe 'for a single object' do

before :all do
rescue_if 'TODO', @skip do
@user.name = 'dkubb'
@user.description = 'test'
@user.reload
end
end

it { @user.name.should eql('dbussink') }

it 'should also reload previously loaded attributes' do
@user.attribute_loaded?(:description).should be_true
end
end

it { @user.name.should eql('dbussink') }
describe 'for when the object is changed outside another object' do

before :all do
@user2 = @user.dup
@user2.name = 'dkubb'
@user2.save
@user.reload
end

it 'should reload the object from the data store' do
pending "Reload forces all attributes to be retrieved again" do
@user.name.should eql('dkubb')
end
end

it 'should also reload previously loaded attributes' do
@user.attribute_loaded?(:description).should be_true
end

end
Expand Down

0 comments on commit 0cd150e

Please sign in to comment.