Sha256: a5235900d5963a928ecd166977ff86b6942e5fd5269be76c3d14c06a04999171

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Base, '.new' do
  let(:name)   { :users                                    }
  let(:header) { Relation::Header.coerce([[:id, Integer]]) }
  let(:object) { described_class                           }

  context 'when a Sting is provided for the name' do
    subject { object.new(name.to_s, header) }

    it { should be_instance_of(described_class) }

    its(:name) { should be(name) }

    its(:header) { should be(header) }

    it { should be_empty }
  end

  context 'when no tuples are provided' do
    subject { object.new(name, header) }

    it { should be_instance_of(described_class) }

    its(:name) { should be(name) }

    its(:header) { should be(header) }

    it { should be_empty }
  end

  context 'when tuples are provided' do
    subject { object.new(name, header, tuples) }

    let(:tuples) { LazyEnumerable.new([[1]]) }

    it { should be_instance_of(described_class) }

    its(:name) { should be(name) }

    its(:header) { should be(header) }

    it { should == tuples }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/relation/base/class_methods/new_spec.rb
axiom-0.1.1 spec/unit/axiom/relation/base/class_methods/new_spec.rb