Created
July 24, 2013 15:39
-
-
Save jlebrech/6071738 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 '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 |
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 '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