-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from hosh/master
Fixes to get working with Rails 3.1 and Ruby 1.9.2
- Loading branch information
Showing
13 changed files
with
166 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Intermodal | ||
module RSpec | ||
module AuthenticatedRequests | ||
extend ActiveSupport::Concern | ||
|
||
module ClassMethods | ||
def expects_unauthorized_access_to_respond_with_401 | ||
context 'with unauthorized access credentials' do | ||
let(:http_headers) { { 'X-Auth-Token' => '', 'Accept' => 'application/json' } } | ||
|
||
expects_status(401) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module Intermodal | ||
module RSpec | ||
module PaginatedCollection | ||
extend ActiveSupport::Concern | ||
|
||
module ClassMethods | ||
def expects_pagination(options = {}) | ||
# Default behavior for will_paginate | ||
options[:page] ||= 1 | ||
options[:collection_name] | ||
|
||
context 'when paginating' do | ||
let(:expected_total_pages) { collection.size/per_page + 1 } | ||
let(:collection_element_name) { options[:collection_name] } if options[:collection_name] | ||
let(:responded_collection_metadata) do | ||
case format | ||
when :xml | ||
body[collection_element_name] | ||
else | ||
body | ||
end | ||
end | ||
|
||
if options[:empty_collection] | ||
it 'should have an empty collection' do | ||
body[collection_element_name.to_s].should be_empty | ||
end | ||
else | ||
it 'should have a collection' do | ||
collection | ||
body[collection_element_name.to_s].should_not be_empty | ||
end | ||
end | ||
|
||
it "should be on page #{options[:page]}" do | ||
collection | ||
responded_collection_metadata['page'].should eql(options[:page]) | ||
end | ||
|
||
it 'should have total_pages' do | ||
collection | ||
responded_collection_metadata['total_pages'].should eql(expected_total_pages) | ||
end | ||
|
||
it 'should have total_entries' do | ||
collection | ||
responded_collection_metadata['total_entries'].should eql(collection.size) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.