Sha256: 89b3e3388e87bef1c6a28dc26c40d824e583d44dfe0a8d62b6d57f193bf58201
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' describe Microscope::InstanceMethod::BooleanInstanceMethod do before do run_migration do create_table(:animals, force: true) do |t| t.boolean :fed, default: false end end microscope 'Animal' end describe '#feed!' do let(:animal) { Animal.create(fed: false) } it { expect { animal.feed! }.to change { animal.reload.fed? }.from(false).to(true) } end describe '#not_feed!' do let(:animal) { Animal.create(fed: true) } it { expect { animal.not_feed! }.to change { animal.reload.fed? }.from(true).to(false) } it { expect(animal).to respond_to(:unfeed!) } end describe '#mark_as_fed' do let(:animal) { Animal.create(fed: false) } it { expect { animal.mark_as_fed }.to_not change { animal.reload.fed? } } it { expect { animal.mark_as_fed }.to change { animal.fed? }.from(false).to(true) } end describe '#mark_as_not_fed' do let(:animal) { Animal.create(fed: true) } it { expect { animal.mark_as_not_fed }.to_not change { animal.reload.fed? } } it { expect { animal.mark_as_not_fed }.to change { animal.fed? }.from(true).to(false) } it { expect(animal).to respond_to(:mark_as_unfed) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
microscope-0.6.2 | spec/microscope/instance_method/boolean_instance_method_spec.rb |
microscope-0.6.1 | spec/microscope/instance_method/boolean_instance_method_spec.rb |