Sha256: a13cf141cd172af2fa0c2bfa4789a9980e9bbe00fce4e12a2a5cea6171a77e34

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

require 'gooddata'

describe "Spin a project", :constraint => 'slow' do
  before(:all) do
    @client = ConnectionHelper.create_default_connection

    spec = MultiJson.load(File.read("./spec/data/test_project_model_spec.json"), :symbolize_keys => true)

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

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

    @client.disconnect
  end

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

    GoodData.with_project(@target_project) { |p| GoodData::Metric[:all, :client => @client, :project => @target_project].count.should == 0 }

    @source_project.partial_md_export(metric, :client => @client, :project => @target_project)
    GoodData.with_project(@target_project) do |_p|
      GoodData::Metric[:all, :client => @client, :project => @target_project].count.should == 1
      metric = GoodData::Metric.find_first_by_title(metric_title, :client => @client, :project => @target_project)
      metric.should_not be_nil
      metric.title.should == metric_title
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gooddata-0.6.8 spec/integration/partial_md_export_import_spec.rb