Sha256: a72b0d635060763ed30475e97dc6426ebdd39b1d5f9785e64c2dc69f7247a564

Contents?: true

Size: 836 Bytes

Versions: 10

Compression:

Stored size: 836 Bytes

Contents

require "multi_json"

shared_examples_for "a summarizeable model" do
  describe "#summary" do
    let(:summary_endpoint) {
      [ client.target,
        "v2",
        subject.class.plural_object_name,
        subject.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
      allow(subject).to receive(: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

10 entries across 10 versions & 2 rubygems

Version Path
new_cfoundry-4.9.4 spec/support/shared_examples/model_summary_examples.rb
new_cfoundry-4.9.3 spec/support/shared_examples/model_summary_examples.rb
ncfoundry-4.9.4 spec/support/shared_examples/model_summary_examples.rb
ncfoundry-4.9.3 spec/support/shared_examples/model_summary_examples.rb
ncfoundry-4.9.2 spec/support/shared_examples/model_summary_examples.rb
new_cfoundry-4.9.2 spec/support/shared_examples/model_summary_examples.rb
new_cfoundry-4.9.1 spec/support/shared_examples/model_summary_examples.rb
new_cfoundry-4.9.0 spec/support/shared_examples/model_summary_examples.rb
new_cfoundry-4.8.3 spec/support/shared_examples/model_summary_examples.rb
new_cfoundry-4.8.2 spec/support/shared_examples/model_summary_examples.rb