Sha256: c4bb9e9b52983af365058e73f75da5fdb423e6ad333542cbf54b4ce8230bb54e

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require 'gooddata/models/model'

describe GoodData::Model::SchemaBuilder do
  it "should create a schema" do
    builder = GoodData::Model::SchemaBuilder.new("a_title")
    blueprint = builder.to_blueprint
    expect(blueprint.datasets.first.title).to eq 'A Title'
  end

  it "should create a schema with some columns" do
    builder = GoodData::Model::SchemaBuilder.new("payments")
    builder.add_attribute("id", :title => "My Id")
    builder.add_fact("amount", :title => "Amount")

    blueprint = builder.to_blueprint
    expect(blueprint.attributes.count).to eq(1)
  end

  it "should be able to create from block" do
    builder = GoodData::Model::SchemaBuilder.create("payments") do |d|
      d.add_attribute('attr.id', :title => 'Id')
      d.add_label('label.id.name', :title => 'Id Name', reference: 'attr.id')
      d.add_fact('amount', :title => 'Amount')
    end

    blueprint = builder.to_blueprint
    expect(blueprint.attributes.count).to eq(1)
    expect(blueprint.facts.count).to eq(1)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gooddata-1.1.0-java spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.1.0 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.0.2-java spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.0.2 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.0.1 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.0.1-java spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.0.0-java spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-1.0.0 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-0.6.54 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-0.6.53 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-0.6.52 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-0.6.51 spec/unit/models/blueprint/schema_builder_spec.rb
gooddata-0.6.50 spec/unit/models/blueprint/schema_builder_spec.rb