Skip to content

Instantly share code, notes, and snippets.

@ppworks
Created December 12, 2012 23:40
Show Gist options
  • Save ppworks/4272742 to your computer and use it in GitHub Desktop.
Save ppworks/4272742 to your computer and use it in GitHub Desktop.
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