Sha256: 34eec77738e087fa23f1285315a2bbdbcb03c5c2ba8b62f4f872156a8f77d32d

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 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/mixins/md_id_to_uri'

describe GoodData::Mixin::MdIdToUri do
  before :each do
    @client = ConnectionHelper.create_default_connection
    project = ProjectHelper.get_default_project(client: @client)

    class SomeTestClass
      extend GoodData::Mixin::MdIdToUri
    end

    @opts = { client: @client, project: project }
  end

  after(:each) do
    @client.disconnect
  end

  it 'should throw BadRequest for -1' do
    expect do
      SomeTestClass.identifier_to_uri(@opts, '-1')
    end.to raise_error(RestClient::BadRequest) { |error|
      error.response.should match(/does not match with value '-1'/)
    }
  end

  it 'should return nil for unknown id' do
    expect(SomeTestClass.identifier_to_uri(@opts, '0')).to be_nil
  end

  it 'should get json containing correct id' do
    facts = GoodData::Fact.all(@opts)
    fact  = facts.to_a.first
    uri = SomeTestClass.identifier_to_uri(@opts, fact.identifier)
    res = @client.get(uri)
    expect(res['fact']['meta']['identifier']).to eq fact.identifier
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gooddata-1.0.2-java spec/integration/mixins/id_to_uri_spec.rb
gooddata-1.0.2 spec/integration/mixins/id_to_uri_spec.rb
gooddata-1.0.1 spec/integration/mixins/id_to_uri_spec.rb
gooddata-1.0.1-java spec/integration/mixins/id_to_uri_spec.rb
gooddata-1.0.0-java spec/integration/mixins/id_to_uri_spec.rb
gooddata-1.0.0 spec/integration/mixins/id_to_uri_spec.rb
gooddata-0.6.54 spec/integration/mixins/id_to_uri_spec.rb