Sha256: d4a9fa04f144f9ce807fa18d9e7f452e1bbb3434730fc1abc83285be420da36a
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' require 'parameters/types/array' require 'parameters/types/integer' describe Parameters::Types::Array do let(:array) { [1, 2, 3] } subject { described_class } describe "coerce" do it "should call #to_a" do subject.coerce(array.enum_for).should == array end end context "instance" do let(:element_type) { Parameters::Types::Integer } let(:numbers) { %w[1 2 3] } subject { described_class.new(element_type) } it "should have a Ruby type" do subject.to_ruby.should == Array[Integer] end it "should be equal to another Array type with the same element-type" do subject.should == described_class.new(element_type) end it "should be related to the Array type" do subject.should < described_class end describe "#===" do it "should check the type of each element" do subject.should_not === numbers subject.should === array end end describe "#coerce" do it "should coerce each element" do subject.coerce(numbers).should == array end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
parameters-0.4.4 | spec/types/array_spec.rb |
parameters-0.4.3 | spec/types/array_spec.rb |
parameters-0.4.2 | spec/types/array_spec.rb |
parameters-0.4.0 | spec/types/array_spec.rb |