Skip to content
Browse files

Replace should and should_not with expect

  • Loading branch information...
1 parent 5158ee6 commit 97585b4121dadd4bb93aa31462ff69171ac53878 @sferik sferik committed Oct 9, 2012
Showing with 18 additions and 19 deletions.
  1. +7 −0 spec/helper.rb
  2. +11 −19 spec/mlb_spec.rb
View
7 spec/helper.rb
@@ -4,10 +4,17 @@
add_filter 'spec'
end
end
+
require 'mlb'
require 'rspec'
require 'webmock/rspec'
+RSpec.configure do |config|
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+end
+
def fixture_path
File.expand_path("../../cache", __FILE__)
end
View
30 spec/mlb_spec.rb
@@ -3,59 +3,51 @@
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"))
+ 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
+ it "requests 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
+ expect(a_request(:get, 'http://api.freebase.com/api/service/mqlread').with(:query => {:query => MLB::Team.mql_query})).to have_been_made
end
- it "should return the correct results" do
+ it "returns the correct results" do
teams = MLB::Team.all
- teams.first.name.should == "Arizona Diamondbacks"
+ expect(teams.first.name).to eq "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
+ 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
+ it "returns the correct results" do
teams = MLB::Team.all
- teams.first.name.should == "Arizona Diamondbacks"
+ expect(teams.first.name).to eq "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)
+ 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
+ it "returns the correct results" do
teams = MLB::Team.all
- teams.first.name.should == "Arizona Diamondbacks"
+ expect(teams.first.name).to eq "Arizona Diamondbacks"
end
end
end

0 comments on commit 97585b4

Please sign in to comment.
Something went wrong with that request. Please try again.