Sha256: 7c31ac6435824e21b37971733755451f1aa6c0825f5d82a77554f45be9f9e38c

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require 'spec_helper'
require 'opennorth/represent/models/representatives'

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

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


  context "loaded with sample data" do

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

    describe "#where" do
      subject { loaded_collection.where(elected_office: "MP") }

      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.elected_office == "MP"}
      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/representatives_spec.rb