Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tidied up specs a little

  • Loading branch information...
commit 540d3bc5dc865f8b218b4c2bd07d84a817b4ee22 1 parent 65c5579
@sflinter authored
View
4 spec/application_spec.rb
@@ -4,7 +4,7 @@
include Rack::Test::Methods
def app
- Sinatra::Application.new
+ SemanticTweet
end
it 'should show the default index page' do
@@ -14,7 +14,7 @@ def app
it 'should show the semantictweet page' do
get '/semantictweet'
- last_response.status.should == 302
+ last_response.status.should eq(302)
end
it 'should show the semantictweet friends page' do
View
50 spec/geonames_spec.rb
@@ -4,37 +4,37 @@
it 'should parse Paris' do
location = "Paris"
geo = GeoNames.new(location)
- geo.lat.should == 48.85341
- geo.lng.should == 2.3488
- geo.name.should == "Paris"
- geo.geonameId.should == 2988507
+ geo.lat.should eq(48.85341)
+ geo.lng.should eq(2.3488)
+ geo.name.should eq("Paris")
+ geo.geonameId.should eq(2988507)
end
it 'should parse Paris, FR' do
location = "Paris, FR"
geo = GeoNames.new(location)
- geo.lat.should == 48.85341
- geo.lng.should == 2.3488
- geo.name.should == "Paris"
- geo.geonameId.should == 2988507
+ geo.lat.should eq(48.85341)
+ geo.lng.should eq(2.3488)
+ geo.name.should eq("Paris")
+ geo.geonameId.should eq(2988507)
end
it 'should parse geonames location' do
location = "geonames:5128581"
geo = GeoNames.new(location)
- geo.lat.should == 40.7142691
- geo.lng.should == -74.0059729
- geo.name.should == "New York"
- geo.geonameId.should == 5128581
+ geo.lat.should eq(40.7142691)
+ geo.lng.should eq(-74.0059729)
+ geo.name.should eq("New York")
+ geo.geonameId.should eq(5128581)
end
it 'should handle unknown geoname' do
location = 'geonames:1234567890'
geo = GeoNames.new(location)
- geo.lat.should == 0
- geo.lng.should == 0
- geo.name.should == location
- geo.geonameId.should == 0
+ geo.lat.should eq(0)
+ geo.lng.should eq(0)
+ geo.name.should eq(location)
+ geo.geonameId.should eq(0)
end
it 'should parse lat/lng location' do
@@ -42,10 +42,10 @@
lng = -6.313141
location = "iPhone: #{lat},#{lng}"
geo = GeoNames.new(location)
- geo.lat.should == 53.3095701794021
- geo.lng.should == -6.31271839141846
- geo.name.should == "Manor Grove"
- geo.geonameId.should == 6691015
+ geo.lat.should eq(53.3095701794021)
+ geo.lng.should eq(-6.31271839141846)
+ geo.name.should eq("Manor Grove")
+ geo.geonameId.should eq(6691015)
end
it 'should handle invalid lat/lng location' do
@@ -53,15 +53,15 @@
lng = 200
location = "iPhone: #{lat},#{lng}"
geo = GeoNames.new(location)
- geo.lat.should == 0
- geo.lng.should == 0
- geo.name.should == location
- geo.geonameId.should == 0
+ geo.lat.should eq(0)
+ geo.lng.should eq(0)
+ geo.name.should eq(location)
+ geo.geonameId.should eq(0)
end
it 'should use default location' do
location = 'Somewhere over the ocean'
geo = GeoNames.new(location)
- geo.name.should == location
+ geo.name.should eq(location)
end
end
View
2  spec/spec_helper.rb
@@ -1,7 +1,5 @@
-require 'rubygems'
require 'sinatra'
require 'rspec/core'
-# require 'rspec/interop/test'
require 'rack/test'
# set test environment
View
12 spec/tweeter_spec.rb
@@ -3,24 +3,24 @@
describe "Tweeter integration" do
it 'should create semantic tweet user' do
tweeter = Tweeter.new('semantictweet')
- tweeter.screen_name.should == 'semantictweet'
- tweeter.url.should == 'http://semantictweet.com'
+ tweeter.screen_name.should eq('semantictweet')
+ tweeter.url.should eq('http://semantictweet.com')
end
it 'should create semantic tweet user with followers' do
tweeter = Tweeter.new('semantictweet', 'followers')
- tweeter.screen_name.should == 'semantictweet'
- tweeter.url.should == 'http://semantictweet.com'
+ tweeter.screen_name.should eq('semantictweet')
+ tweeter.url.should eq('http://semantictweet.com')
end
it 'should have the right number of friends' do
tweeter = Tweeter.new('semantictweet')
- tweeter.friends_count.should == tweeter.foafs.size
+ tweeter.friends_count.should eq(tweeter.foafs.size)
end
it 'should not have a geoname without a location' do
tweeter = Tweeter.new('hughglaser', 'friends')
- tweeter.location.should == ''
+ tweeter.location.should eq('')
tweeter.geoname.should be_nil
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.