spec/facemock/oauth/callback_hook_spec.rb in facemock-oauth-0.0.3 vs spec/facemock/oauth/callback_hook_spec.rb in facemock-oauth-0.0.4

- old
+ new

@@ -41,34 +41,34 @@ before { @path = '/' } end context 'with code parameter' do before do - @user = Facemock::Database::User.new({ id: 1, access_token: "test_token" }) - @authorization_code = Facemock::Database::AuthorizationCode.new(user_id: @user.id) + @user = Facemock::User.new({ id: 1, access_token: "test_token" }) + @authorization_code = Facemock::AuthorizationCode.new(user_id: @user.id) end context 'when authorization code does not found', assert: :RequestSuccess do before do - allow(Facemock::Database::AuthorizationCode).to receive(:find_by_string) { nil } + allow(Facemock::AuthorizationCode).to receive(:find_by_string) { nil } @path = path + "?code=#{@authorization_code.string}" end end context 'when authorization code found but user does not found', assert: :RequestSuccess do before do - allow(Facemock::Database::AuthorizationCode).to receive(:find_by_string) { @authorization_code } - allow(Facemock::Database::User).to receive(:find_by_id) { nil } + allow(Facemock::AuthorizationCode).to receive(:find_by_string) { @authorization_code } + allow(Facemock::User).to receive(:find_by_id) { nil } @path = path + "?code=#{@authorization_code.string}" end end context 'when authorization code found by code parameter', assert: :SetAuthHash do before do - allow(Facemock::Database::AuthorizationCode).to receive(:find_by_string) { @authorization_code } - allow(Facemock::Database::User).to receive(:find_by_id) { @user } - allow(Facemock::Database::User).to receive(:find_by_access_token) { @user } + allow(Facemock::AuthorizationCode).to receive(:find_by_string) { @authorization_code } + allow(Facemock::User).to receive(:find_by_id) { @user } + allow(Facemock::User).to receive(:find_by_access_token) { @user } @path = path end end end end @@ -77,14 +77,14 @@ context "when path variable set '/test'", assert: :SetAuthHash do before do @path = "/test" Facemock::OAuth::CallbackHook.path = @path - @user = Facemock::Database::User.new({ id: 1, access_token: "test_token" }) - @authorization_code = Facemock::Database::AuthorizationCode.new(user_id: @user.id) - allow(Facemock::Database::AuthorizationCode).to receive(:find_by_string) { @authorization_code } - allow(Facemock::Database::User).to receive(:find_by_id) { @user } - allow(Facemock::Database::User).to receive(:find_by_access_token) { @user } + @user = Facemock::User.new({ id: 1, access_token: "test_token" }) + @authorization_code = Facemock::AuthorizationCode.new(user_id: @user.id) + allow(Facemock::AuthorizationCode).to receive(:find_by_string) { @authorization_code } + allow(Facemock::User).to receive(:find_by_id) { @user } + allow(Facemock::User).to receive(:find_by_access_token) { @user } end after { Facemock::OAuth::CallbackHook.path = path } end end end