Sha256: b051dc84b767f00b79a5f169219d33cb439baa0891ebf55fcf8e64af23cfb91b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Response, '#valid?' do
  subject { object.valid? }

  context 'with status and body' do
    let(:object) { described_class.build(Response::Status::OK, {}, double('Body')) }

    it { should be(true) }

    it_should_behave_like 'an idempotent method'
  end

  context 'without body' do
    let(:object) { described_class.build.with_status(Response::Status::OK) }

    it { should be(false) }

    it_should_behave_like 'an idempotent method'
  end

  context 'without status' do
    let(:object) { described_class.build.with_body(double('Body')) }

    it { should be(false) }

    it_should_behave_like 'an idempotent method'
  end

  context 'without headers' do
    let(:object) { described_class.build(Response::Status::OK, Response::Undefined, double('Body')) }

    it { should be(false) }

    it_should_behave_like 'an idempotent method'
  end

  context 'without status and body' do
    let(:object) { described_class.build }

    it { should be(false) }

    it_should_behave_like 'an idempotent method'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
response-0.0.5 spec/unit/response/valid_predicate_spec.rb