spec/acfs/resource/persistance_spec.rb in acfs-1.5.1 vs spec/acfs/resource/persistance_spec.rb in acfs-1.6.0
- old
+ new
@@ -99,16 +99,16 @@
context 'unloaded model' do
let!(:model) { model_class.find 1 }
describe '#update_attributes' do
- subject { -> { model.update_attributes name: 'John' } }
+ subject { -> { model.update_attributes({name: 'John'}) } }
it { expect { subject.call }.to raise_error Acfs::ResourceNotLoaded }
end
describe '#update_attributes!' do
- subject { -> { model.update_attributes! name: 'John' } }
+ subject { -> { model.update_attributes!({name: 'John'}) } }
it { expect { subject.call }.to raise_error Acfs::ResourceNotLoaded }
end
end
context 'loaded model' do
@@ -177,41 +177,41 @@
describe '#update_atributes!' do
let(:model) { model_class.find 1 }
before { model; Acfs.run }
it 'should set attributes' do
- model.update_attributes name: 'Idefix'
+ model.update_attributes({name: 'Idefix'})
expect(model.attributes.symbolize_keys).to eq id: 1, name: 'Idefix', age: 12
end
it 'should save resource' do
- expect(model.__getobj__).to receive(:save).with({})
- model.update_attributes name: 'Idefix'
+ expect(model.__getobj__).to receive(:save)
+ model.update_attributes({name: 'Idefix'})
end
- it 'should pass second hash to save' do
+ it 'should kwargs to save' do
expect(model.__getobj__).to receive(:save).with(bla: 'blub')
- model.update_attributes({name: 'Idefix'}, {bla: 'blub'})
+ model.update_attributes({name: 'Idefix'}, bla: 'blub')
end
end
describe '#update_atributes' do
let(:model) { model_class.find 1 }
before { model; Acfs.run }
it 'should set attributes' do
- model.update_attributes! name: 'Idefix'
+ model.update_attributes!({name: 'Idefix'})
expect(model.attributes.symbolize_keys).to eq id: 1, name: 'Idefix', age: 12
end
it 'should save resource' do
- expect(model.__getobj__).to receive(:save!).with({})
- model.update_attributes! name: 'Idefix'
+ expect(model.__getobj__).to receive(:save!)
+ model.update_attributes!({name: 'Idefix'})
end
it 'should pass second hash to save' do
expect(model.__getobj__).to receive(:save!).with(bla: 'blub')
- model.update_attributes!({name: 'Idefix'}, {bla: 'blub'})
+ model.update_attributes!({name: 'Idefix'}, bla: 'blub')
end
end
end
describe '.save!' do