Sha256: 65ffaa9fa23c21090832bee2012613f14b9c8ffdfa5e94ff78a87a5c4c96d560

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

require 'gooddata'

describe "Spin a project", :constraint => 'slow' do
  before(:all) do
    spec = MultiJson.load(File.read("./spec/data/test_project_model_spec.json"), :symbolize_keys => true)
    ConnectionHelper::create_default_connection

    @source_project = GoodData::Model::ProjectCreator.migrate({:spec => spec, :token => ConnectionHelper::GD_PROJECT_TOKEN})
    @target_project = GoodData::Model::ProjectCreator.migrate({:spec => spec, :token => ConnectionHelper::GD_PROJECT_TOKEN})
  end

  after(:all) do
    @source_project.delete unless @source_project.nil?
    @target_project.delete unless @target_project.nil?
  end

  it "should transfer a metric" do
    GoodData.with_project(@source_project) do |p|
      f = GoodData::Fact.find_first_by_title('Lines Changed')
      metric_title = "Testing metric to be exported"
      metric = GoodData::Metric.xcreate(:expression => "SELECT SUM(#\"#{f.title}\")", :title => metric_title)
      metric.save

      GoodData.with_project(@target_project) {|p| GoodData::Metric[:all].count.should == 0}
      p.partial_md_export([metric.uri], :project => @target_project)
      GoodData.with_project(@target_project) do |p|
        GoodData::Metric[:all].count.should == 1
        metric = GoodData::Metric.find_first_by_title(metric_title)
        metric.should_not be_nil
        metric.title.should == metric_title
      end

    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gooddata-0.6.7 spec/integration/partial_md_export_import_spec.rb
gooddata-0.6.6 spec/integration/partial_md_export_import_spec.rb
gooddata-0.6.5 spec/integration/partial_md_export_import_spec.rb