Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created July 24, 2013 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlebrech/6071738 to your computer and use it in GitHub Desktop.
Save jlebrech/6071738 to your computer and use it in GitHub Desktop.
require 'digest/sha2'
module GoogleAuthoriseHelper
def google_auth_url(user_id)
encoded_id = encode_id_and_store(user.id)
end
def encode_id_and_store(user_id)
sha256 = Digest::SHA2.new(256)
sha256.digest(user_id)
User.find(user_id).update(:google_callback_encoded_id => user_id)
end
end
require 'spec_helper'
describe GoogleAuthoriseHelper do
include GoogleAuthoriseHelper
describe "#google_auth_url" do
#stub_chain(:current_user, :id).and_return 1
google_auth_url(1).should eql ""
end
describe "encode_id_and_store" do
encode_id_and_store(1).should eql ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment