Sha256: 7aaa816c756b09a5eb468ba98f43ded12bf4ce22fdc9ae5a068ca080053f6814
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Remarkable::DSL::Optionals do before(:each) do @matcher = Remarkable::Specs::Matchers::BeAPersonMatcher.new end it "should create optional methods on the fly" do @matcher.first_name('José') @matcher.instance_variable_get('@options')[:first_name].should == 'José' @matcher.last_name('Valim') @matcher.instance_variable_get('@options')[:last_name].should == 'Valim' end it "should allow defaults values" do @matcher.age @matcher.instance_variable_get('@options')[:age].should == 18 end it "should allow alias to be set" do @matcher.family_name('Valim') @matcher.instance_variable_get('@options')[:last_name].should == 'Valim' end it 'should provide a description with optionals' do @matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1) @matcher.description.should == 'contain 1 not checking for blank' @matcher.allow_blank(10) @matcher.description.should == 'contain 1 with blank equal 10' @matcher.allow_blank(true) @matcher.description.should == 'contain 1 with blank equal true' @matcher.allow_nil(true) @matcher.description.should == 'contain 1 allowing nil and with blank equal true' @matcher.allow_nil(false) @matcher.description.should == 'contain 1 not allowing nil and with blank equal true' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
remarkable-3.0.2 | spec/dsl/optionals_spec.rb |
remarkable-3.0.4 | spec/dsl/optionals_spec.rb |
remarkable-3.0.3 | spec/dsl/optionals_spec.rb |