Sha256: a8f1592d8b66c4a99b3b4893c23f2b294d18929be49bef42576aa84b29a542f5
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
remarkable-3.0.0 | spec/dsl/optionals_spec.rb |
remarkable-3.0.1 | spec/dsl/optionals_spec.rb |