Sha256: bdce7cdba9cb07abbecb2d61a392c57191227b34fc98e929e4ce3bdc4bc76f84
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
require 'spec_helper' module FluentConditions describe BooleanAccessorDefiner do it "should add accessor methods" do clazz = Class.new do include FluentConditions attr_accessor :admin fluent :admin end @obj = clazz.new @obj.is.should respond_to(:admin) @obj.is.should respond_to(:admin?) @obj.is.should respond_to(:not_admin) @obj.is.should respond_to(:not_admin?) end end describe TextValueAccessorDefiner do it "should add accessor methods" do clazz = Class.new do include FluentConditions attr_accessor :color fluent :color, :values => [:red, :green] end @product = clazz.new @product.is.should respond_to(:red) @product.is.should respond_to(:green) @product.is.should respond_to(:not_red) @product.is.should respond_to(:not_green) @product.is.should respond_to(:red?) @product.is.should respond_to(:green?) @product.is.should respond_to(:not_red?) @product.is.should respond_to(:not_green?) end end describe CustomAccessorDefiner do it "should add accessor methods" do clazz = Class.new do include FluentConditions attr_accessor :length fluent :length, :as => :long, :if => proc { |length| length >= 500 } fluent :length, :as => :short, :if => proc { |length| length < 500 } end @post = clazz.new @post.is.should respond_to(:long) @post.is.should respond_to(:not_long) @post.is.should respond_to(:long?) @post.is.should respond_to(:not_long?) @post.is.should respond_to(:short) @post.is.should respond_to(:not_short) @post.is.should respond_to(:short?) @post.is.should respond_to(:not_short?) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent_conditions-0.0.3 | spec/fluent_conditions/accessor_definers_spec.rb |