Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up spec descriptions (less should, more do)

  • Loading branch information...
commit a164efd7a2a1da7587352678cb712bda5eeb7429 1 parent ca68e7e
Gabriel Evans authored
Showing with 24 additions and 23 deletions.
  1. +15 −14 spec/eventful/event_spec.rb
  2. +9 −9 spec/eventful/request_spec.rb
View
29 spec/eventful/event_spec.rb
@@ -1,26 +1,27 @@
require 'spec_helper'
describe Eventful::Event do
-
+
describe '.search' do
context 'when coordinates are provided' do
use_vcr_cassette 'events/search/with_coordinates'
-
- subject { Eventful::Event.search(location: '32.746682,-117.162741', within: 25) }
-
+
+ let(:events) { Eventful::Event.search(location: '32.746682,-117.162741', within: 25) }
+ subject { events }
+
it 'returns an array of events' do
+ subject.should be_kind_of(Array)
subject.first.should be_kind_of(Eventful::Event)
end
-
- it 'should be a success' do
- subject.success? == true
- end
-
- it 'should respond to title' do
- subject.first.title should_not be_nil
+
+ it { should be_success }
+
+ context 'the first event' do
+ subject { events.first }
+
+ its(:title) { should_not be_nil }
end
-
end
end
-
-end
+
+end
View
18 spec/eventful/request_spec.rb
@@ -6,7 +6,7 @@
include Eventful::Request
end
end
-
+
let(:url) { %r{^http://api.eventful.com/rest} }
let(:client) { http.new }
@@ -24,7 +24,7 @@
WebMock.stub_request(:any, /.*/)
end
- it 'should execute a GET request' do
+ it 'executes a GET request' do
subject
WebMock.should have_requested(:get, url)
end
@@ -37,7 +37,7 @@
WebMock.stub_request(:any, url)
end
- it 'should execute a POST request with the given data' do
+ it 'executes a POST request with the given data' do
subject
WebMock.should have_requested(:post, url).with(:body => 'something')
end
@@ -50,7 +50,7 @@
WebMock.stub_request(:any, url)
end
- it 'should execute a PUT request with the given data' do
+ it 'executes a PUT request with the given data' do
subject
WebMock.should have_requested(:put, url).with(:body => 'something')
end
@@ -63,27 +63,27 @@
WebMock.stub_request(:any, url)
end
- it 'should execute a DELETE request' do
+ it 'executes a DELETE request' do
subject
WebMock.should have_requested(:delete, url)
end
end
context '#connection' do
- it 'should accept XML responses' do
+ it 'accepts XML responses' do
Faraday::Connection.should_receive(:new).with(hash_including(:headers => hash_including('Accept' => 'text/xml, application/xml; charset=utf-8')))
subject.connection
end
- it 'should set the user agent' do
+ it 'sets the user agent' do
Faraday::Connection.should_receive(:new).with(hash_including(:headers => hash_including('User-Agent' => subject.user_agent)))
subject.connection
end
end
context '#user_agent' do
- it 'should build a user agent containing the release, Ruby, and platform versions' do
+ it 'returns a user agent containing the release, Ruby, and platform versions' do
subject.user_agent.should =~ %r{^eventful-ruby/[0-9\.]+ \(Rubygems; Ruby [0-9\.]+ .+\)$}
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.