spec/rentjuicer/response_spec.rb in rentjuicer-0.2.1 vs spec/rentjuicer/response_spec.rb in rentjuicer-0.3.0
- old
+ new
@@ -46,6 +46,29 @@
@results = @neighborhoods.find_all
@results.success?.should be_true
end
end
+ context "method missing" do
+ before do
+ @rentjuicer = new_rentjuicer
+ @listings = Rentjuicer::Listings.new(@rentjuicer)
+ mock_get('/listings.json', 'listings.json', {
+ :neighborhoods => "South Boston",
+ :order_by => "rent",
+ :order_direction => "asc"
+ })
+ @results = @listings.search(:neighborhoods => "South Boston")
+ end
+
+ it "should allow response.body methods to be called on response" do
+ body = stub(:total_count => 25)
+ @results.body = body
+ @results.total_count.should == 25
+ end
+
+ it "should call super if body does not response to the method" do
+ lambda { @results.bad_method }.should raise_error(NoMethodError, /undefined method `bad_method'/)
+ end
+ end
+
end