Sha256: 92ba94f01065c680ff945ef71dc6afec8f4bbe2e975fe724980db2bfd207c78b
Contents?: true
Size: 1014 Bytes
Versions: 1
Compression:
Stored size: 1014 Bytes
Contents
require 'spec_helper' describe Helpers::MethodBuilder do describe 'a builder method' do let :model do model_class = Class.new do extend Helpers::MethodBuilder builder_method :name end model_class.new end context 'parameter is nil' do it 'should set the value to nil' do model.name(:joe) model.name(nil) expect(model.name).to be_nil end end it 'should set a value' do model.name(:joe) model.name.should == :joe end it 'should chain' do model.name(:joe).should == model end it 'should work with booleans' do model.name(false) model.name.should == false end end it 'should let you define more than one builder method at a time' do model_class = Class.new do extend Helpers::MethodBuilder builder_methods :foo, :bar end model = model_class.new model.respond_to?(:foo).should be_true model.respond_to?(:bar).should be_true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mirage-3.0.13 | spec/mirage/client/helpers/method_builder_spec.rb |