Sha256: 76afdb0ffd59c105416dc6a3834d3678c961808df4f72d18623abb64d3fb5f4e

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'
require 'Opennorth/represent/models/offices'

describe Opennorth::Represent::Offices, type: :collection do
  let(:service) { Opennorth::Represent.new({}) }

  let(:sample_set) { service.get_postal_code("V6H2V4").body["representatives_centroid"].last["offices"] }


  context "loaded with sample data" do

    let(:loaded_collection) { described_collection.load(sample_set) }

    describe "#where" do
      subject { loaded_collection.where(type: "legislature") }

      it "should return a collection" do
        expect(subject).to have(1).item
      end

      it "should contain only matches" do
        expect(subject).to be_all {|rep| rep.type == "legislature"}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opennorth-represent-0.1.0 spec/opennorth/represent/models/offices_spec.rb