I'm working on a gem: https://github.com/tbbooher/govtrack/tree/with_reprah. If I play around in irb, I see the behavior I want:
tbbooher@govtrack:~/workspace (with_reprah) $ irb -Ilib/ 2.1.4-p265 :001 > require 'govtrack' => true 2.1.4-p265 :002 > bill = GovTrack::Bill.find_by_id(2343) => # c = bill.committees.first => # 2.1.4-p265 :004 > c.class => GovTrack::Committee
But, I want to test this, so I have the following test with rspec-3.1.0:
context 'when i have a bill', :vcr do let(:bill){ GovTrack::Bill.find_by_id(2343) } # this passes it "should be a Senate Committee on the Judiciary" do expect(bill.committees.first.name).to eql("Senate Committee on the Judiciary") end it "should have a committee of type GovTrack::Committee" do expect(bill.committees.first.class.should).to be_a GovTrack::Committee end end
The result is:
1) GovTrack::Bill when i have a bill should have a committee of type GovTrack::Committee Failure/Error: expect(bill.committees.first.class.should).to be_a GovTrack::Committee expected # to be a kind of GovTrack::Committee # ./spec/govtrack/bill_spec.rb:68:in `block (3 levels) in '
So the GovTrack::Committee is not of class GovTrack::Committee . . .
Any troubleshooting options appreciated.