pull/11671/head
Juan Ignacio Sánchez Lara 8 years ago
parent 91d454c19c
commit ebb2ea528e

@ -1,3 +1,3 @@
module CartoGearsApi
VERSION = "0.0.1"
VERSION = "0.0.1".freeze
end

@ -13,16 +13,16 @@ describe CartoGearsApi::UsersService do
# This test is 100% bound to implementation. It's mostly a PoC for unit testing
# within Gears and should not be used as an example.
it 'returns the logged user based on subdomain and warden' do
user = double()
user = double
user.stub(:email).and_return(email)
warden = double()
warden = double
warden.should_receive(:user).once.and_return(user)
request = double()
request.should_receive(:env).once.and_return({ 'warden' => warden })
request = double
request.should_receive(:env).once.and_return('warden' => warden)
CartoDB.should_receive(:extract_subdomain).with(request).and_return(username)
logged_user = service.logged_user(request)
logged_user.email.should eq user.email
end
end
end
end

@ -10,7 +10,7 @@ end
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
Rails.backtrace_cleaner.remove_silencers!

@ -56,4 +56,3 @@ module Dummy
config.assets.version = '1.0'
end
end

@ -7,4 +7,4 @@ if File.exist?(gemfile)
Bundler.setup
end
$:.unshift File.expand_path('../../../../lib', __FILE__)
$:.unshift File.expand_path('../../../../lib', __FILE__)

@ -22,7 +22,7 @@ Dummy::Application.configure do
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the

@ -1,7 +1,7 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!

Loading…
Cancel
Save