Sha256: 593a3d929a7c3ab8d83ebe5e334519e57242b902b3c4cb91b73d7283fddb1a61
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Acfs::Resource::Dirty do let(:model) { MyUser.new } before do stub_request(:get, 'http://users.example.org/users/1') .to_return response id: 1, name: 'Anon', age: 12 stub_request(:post, 'http://users.example.org/users') .to_return response id: 5, name: 'dhh', age: 12 end it 'includes ActiveModel::Dirty' do expect(model).to be_a ActiveModel::Dirty end describe '#changed?' do context 'after attribute change' do let(:user) { MyUser.new name: 'dhh' } it { expect(user).to be_changed } context 'and saving' do before { user.save } it { expect(user).not_to be_changed } end end context 'after model load' do let(:user) { MyUser.find 1 } before { user && Acfs.run } it { expect(user).not_to be_changed } end context 'after model new without attrs' do let(:user) { MyUser.new } it { expect(user).not_to be_changed } end context 'after model new with attrs' do let(:user) { MyUser.new name: 'Uschi' } it { expect(user).to be_changed } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acfs-2.0.0 | spec/acfs/resource/dirty_spec.rb |