spec/support/request_spec_helpers.rb in pwb-0.0.1 vs spec/support/request_spec_helpers.rb in pwb-0.0.2
- old
+ new
@@ -1,7 +1,6 @@
module RequestSpecHelpers
-
# https://github.com/plataformatec/devise/wiki/How-To:-sign-in-and-out-a-user-in-Request-type-specs-(specs-tagged-with-type:-:request)
include Warden::Test::Helpers
# def self.included(base)
# base.before(:each) { Warden.test_mode! }
@@ -26,16 +25,16 @@
def sign_out(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
logout(scope)
end
+ # http://matthewlehner.net/rails-api-testing-guidelines/
def response_body_as_json
JSON.parse(response.body)
end
private
def warden_scope(resource)
resource.class.name.underscore.to_sym
end
-
end