Created
October 24, 2014 08:21
-
-
Save paulspencerwilliams/f54b581a7bf34db33df8 to your computer and use it in GitHub Desktop.
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
require 'rspec/expectations' | |
include ActionController::UrlFor | |
#include ActionController::RackDelegation | |
RSpec::Matchers.define :be_a_created_for do | expected | | |
match do | actual | | |
expect(actual).to have_http_status(:created) | |
expect(actual.headers["Locaton"]).to eql(url_for(expected)) | |
end | |
failure_message do |actual| | |
"Expected response to be a <created>, but was #{actual.status} | |
Expected Location to be a <#{expected.location}>, but was #{actual.headers['Location']}" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment