Sha256: 2f85778f5b69706a3733589d597de6f8d623da7b4348f71a2986987956eb1a7d
Contents?: true
Size: 1.5 KB
Versions: 4
Compression:
Stored size: 1.5 KB
Contents
require File.expand_path('../spec_helper', __FILE__) describe MLB::Team, ".all" do context "with connection" do before do stub_request(:get, 'http://api.freebase.com/api/service/mqlread'). with(:query => {:query => MLB::Team.mql_query}). to_return(:body => fixture("teams.json")) end after do MLB::Team.reset end it "should request the correct resource" do MLB::Team.all a_request(:get, 'http://api.freebase.com/api/service/mqlread'). with(:query => {:query => MLB::Team.mql_query}). should have_been_made end it "should return the correct results" do teams = MLB::Team.all teams.first.name.should == "Arizona Diamondbacks" end end context "with timeout" do before do stub_request(:get, 'http://api.freebase.com/api/service/mqlread'). with(:query => {:query => MLB::Team.mql_query}). to_timeout end after do MLB::Team.reset end it "should return the correct results" do teams = MLB::Team.all teams.first.name.should == "Arizona Diamondbacks" end end context "without connection" do before do stub_request(:get, 'http://api.freebase.com/api/service/mqlread'). with(:query => {:query => MLB::Team.mql_query}). to_raise(SocketError) end after do MLB::Team.reset end it "should return the correct results" do teams = MLB::Team.all teams.first.name.should == "Arizona Diamondbacks" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mlb-0.5.2 | spec/mlb_spec.rb |
mlb-0.5.1 | spec/mlb_spec.rb |
mlb-0.5.0 | spec/mlb_spec.rb |
mlb-0.4.0 | spec/mlb_spec.rb |