Sha256: 41476204ba7bd5dcc19c840006e04715514dc89623bc2ec3aabdcd446cbcfec1
Contents?: true
Size: 793 Bytes
Versions: 1
Compression:
Stored size: 793 Bytes
Contents
class User < ActiveRecord::Base end RSpec.describe Kagetsu do after { User.delete_all } describe '.create_or_update' do context 'when user do not exist' do specify do expect { User.create_or_update(key: { name: 'kotoko' }, update_attributes: { email: 'kotoko@example.com' }) } .to change { User.count } .from(0) .to(1) end end context 'when user exist' do let!(:user) { User.create!(name: 'kotoko', email: 'old@example.com') } specify 'email is changed' do expect { User.create_or_update(key: { name: 'kotoko' }, update_attributes: { email: 'new@example.com' }) } .to change { user.reload.email } .from('old@example.com') .to('new@example.com') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kagetsu-1.0.0 | spec/kagetsu_spec.rb |