Created
December 12, 2012 23:40
-
-
Save ppworks/4272742 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module ControllerMacros | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def request_should_be_success method, path, params = {} | |
describe "#{method.to_s.upcase} '#{path.to_s}'" do | |
before do | |
send method, path, params | |
end | |
subject { response } | |
it "response should returns http success" do | |
should be_success | |
end | |
end | |
end | |
end | |
def sign_in(id, password) | |
request.env['HTTP_AUTHORIZATION'] = 'Basic ' + Base64::encode64("#{id}:#{password}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment