Sha256: 6dca0a2e8f5bdb37ebc1ede09c1dc203332963b4585c14b487113027950de880

Contents?: true

Size: 1000 Bytes

Versions: 4

Compression:

Stored size: 1000 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_base' do
  subject { object.visit_veritas_relation_base(base_relation) }

  let(:relation_name) { 'users'                                          }
  let(:id)            { Attribute::Integer.new(:id)                      }
  let(:name)          { Attribute::String.new(:name)                     }
  let(:age)           { Attribute::Integer.new(:age, :required => false) }
  let(:header)        { [ id, name, age ]                                }
  let(:body)          { [ [ 1, 'Dan Kubb', 35 ] ].each                   }
  let(:base_relation) { Relation::Base.new(relation_name, header, body)  }
  let(:object)        { described_class.new                              }

  it_should_behave_like 'a generated SQL SELECT query'

  its(:to_s)        { should eql('SELECT "id", "name", "age" FROM "users"') }
  its(:to_subquery) { should eql('(SELECT * FROM "users")')                 }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-sql-generator-0.0.7 spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_base_spec.rb
veritas-sql-generator-0.0.6 spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_base_spec.rb
veritas-sql-generator-0.0.5 spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_base_spec.rb
veritas-sql-generator-0.0.4 spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_base_spec.rb