Sha256: c59502127aa503d6e1de0c5a04d39a23d27fb629b670e59299053f434f76565e

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe ApiValidator::Spec::Results do
  let(:validator) { stub(:name => "GET /foo") }
  let(:other_validator) { stub(:name => "with bar") }
  let(:results) {
    [
      {
        :response_headers => {
          :assertions => [],
          :failed_assertions => [],
          :diff => [],
          :valid => true
        }
      }
    ]
  }
  let(:instance) { described_class.new(validator, results) }
  let(:other_instance) { described_class.new(other_validator, results) }

  describe "#as_json" do
    let(:expected_output) {
      {
        "GET /foo" => {
          :results => results
        }
      }
    }
    it "returns results nested under validator name" do
      expect(instance.as_json).to eql(expected_output)
    end
  end

  describe "#merge!" do
    let(:expected_output) {
      {
        "GET /foo" => {
          :results => results,
          "with bar" => {
            :results => results
          }
        }
      }
    }

    it "merges given results as children and returns self" do
      expect(instance.merge!(other_instance)).to eql(instance)
      expect(instance.results).to eql(expected_output)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api-validator-0.0.1 spec/spec_results_spec.rb