Sha256: 3de3b30a950da0e2e5d4e52bda6e3be2be6928de53a0eae9e4eee89b0d4a3c93
Contents?: true
Size: 647 Bytes
Versions: 5
Compression:
Stored size: 647 Bytes
Contents
require 'spec_helper' describe Virtus::Attribute, '#set' do let(:attribute_class) do Class.new(Virtus::Attribute::Integer) do def set(instance, value) super(instance, coerce(value) + 1) unless value.nil? end end end let(:model) do model = Class.new do include Virtus end model.attribute(:count, attribute_class) model end let(:object) do model.new end context 'when overridden' do let(:input_value) { 1 } let(:output_value) { 2 } before do object.count = input_value end subject { object } its(:count) { should eql(output_value) } end end
Version data entries
5 entries across 5 versions & 1 rubygems