Sha256: 9f8d5fa2959cfbdd6093578ca4bebe60fb8fa55d93da221e279c7a70506e78e8

Contents?: true

Size: 817 Bytes

Versions: 55

Compression:

Stored size: 817 Bytes

Contents

require "multi_json"

shared_examples_for 'a summarizeable model' do
  describe '#summary' do
    let(:summary_endpoint) {
      [ client.target,
        "v2",
        mymodel.plural_object_name,
        myobject.guid,
        "summary"
      ].join("/")
    }

    it 'returns the summary endpoint payload' do
      req = stub_request(:get, summary_endpoint).to_return :status => 200,
        :body => MultiJson.encode(summary_attributes)

      expect(subject.summary).to eq(summary_attributes)
      expect(req).to have_been_requested
    end
  end

  describe '#summarize!' do
    it 'defines basic attributes via #summary' do
      stub(subject).summary { summary_attributes }

      subject.summarize!

      summary_attributes.each do |k, v|
        expect(subject.send(k)).to eq v
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
cfoundry-1.5.3 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.5.2 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.5.1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.5.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.4.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.3.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.2.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.1.0.rc4 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.1.0.rc3 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.1.0.rc2 spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.1.0.rc1 spec/support/shared_examples/model_summary_examples.rb
static-1.0.3 vendor/cfoundry-0.5.2/spec/support/shared_examples/model_summary_examples.rb
cfoundry-1.0.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc15 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc14 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc13 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc12 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc11 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc10 spec/support/shared_examples/model_summary_examples.rb
cfoundry-0.7.0.rc9 spec/support/shared_examples/model_summary_examples.rb