spec/integration/user_commands_spec.rb in rom-rails-0.9.0 vs spec/integration/user_commands_spec.rb in rom-rails-1.0.0.beta1
- old
+ new
@@ -1,14 +1,14 @@
-require 'spec_helper'
+RSpec.describe 'User commands' do
+ subject(:users) { rom.commands[:users] }
-describe 'User commands' do
- subject(:users) { rom.command(:users) }
-
describe 'delete' do
it 'deletes record' do
- rom.relations.users.insert(name: 'Piotr', email: 'piotr@test.com')
- result = users.try { users.delete.by_name('Piotr') }
+ relation = rom.relations[:users]
+ relation.insert(name: 'Piotr', email: 'piotr@test.com')
- expect(result.error).to be(nil)
+ expect{
+ users.delete.by_name('Piotr').call
+ }.to change(relation, :count).by(-1)
end
end
end