Sha256: 2b9526159338040c9cfbebc79ef3b799fad86f018b12e8fc06d3752d0b176035

Contents?: true

Size: 823 Bytes

Versions: 57

Compression:

Stored size: 823 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
      subject.stub(: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

57 entries across 57 versions & 1 rubygems

Version Path
cfoundry-4.3.6 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.5 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.5.rc1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.4 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.4.rc1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.3 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.2.rc1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.3.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.2.0.rc spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.1.0 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.4.rc2 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.4.rc1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.3 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.2.rc5 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.2.rc4 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.2.rc3 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.2.rc2 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.2.rc1 spec/support/shared_examples/model_summary_examples.rb
cfoundry-4.0.1 spec/support/shared_examples/model_summary_examples.rb