Sha256: 72db24fa669d8ae85cbac37d5cf597a3733302aae3b85ebe6f0dfab66f4bf40b
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Axiom::Types::Object, '.infer' do subject { object.infer(arg) } let(:object) { described_class } context 'when the argument is the type object' do let(:arg) { object } it { should be(object) } end context 'when the argument is ::BasicObject' do let(:arg) { ::BasicObject } it { should be(object) } end context 'when the argument is ::Object' do let(:arg) { ::Object } it { should be(object) } end Axiom::Types::Object.descendants.each do |descendant| primitive = descendant.primitive context "when the argument is #{descendant}" do let(:object) { descendant } let(:arg) { object } it { should be(object) } end context "when the argument is ::#{primitive}" do let(:arg) { primitive } if primitive.instance_of?(::Module) it 'does not match modules' do should be_nil end else it 'matches all classes' do should be(object) end end end end context 'when the argument is an object instance' do let(:arg) { ::Object.new } it { should be_nil } end context 'when the argument is nil' do let(:arg) { nil } it { should be_nil } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
axiom-types-0.0.4 | spec/unit/axiom/types/object/class_methods/infer_spec.rb |
axiom-types-0.0.3 | spec/unit/axiom/types/object/class_methods/infer_spec.rb |