From bc0bb9c1f52f0da8d06e0b4fb613feead6bba9bd Mon Sep 17 00:00:00 2001
From: Dmitry Kovalenok <dmitry.kovalenok@twinslash.com>
Date: Tue, 13 Nov 2012 21:07:28 +0300
Subject: [PATCH] testing

---
 .../hooks/_view_account_login_bottom.html.erb |  2 +-
 assets/stylesheets/buttons.css                |  6 ++--
 .../redmine_oauth_controller_test.rb          | 29 ++++++++++++++-----
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/app/views/hooks/_view_account_login_bottom.html.erb b/app/views/hooks/_view_account_login_bottom.html.erb
index 969cc24..df2ee0a 100644
--- a/app/views/hooks/_view_account_login_bottom.html.erb
+++ b/app/views/hooks/_view_account_login_bottom.html.erb
@@ -4,7 +4,7 @@
   <%= link_to oauth_google_path do %>
     <%= button_tag class: 'button-login' do %>
       <%= image_tag('/plugin_assets/redmine_omniauth_google/images/google_login_icon.jpg', class: 'button-login-icon', alt: l(:login_via_google)) %>
-      <%= content_tag :div, 'Login_via_google', class: 'button-login-text' %>
+      <%= content_tag :div, l(:login_via_google), class: 'button-login-text' %>
     <% end %>
   <% end %>
 <% end %>
\ No newline at end of file
diff --git a/assets/stylesheets/buttons.css b/assets/stylesheets/buttons.css
index 91cbada..eb6d338 100644
--- a/assets/stylesheets/buttons.css
+++ b/assets/stylesheets/buttons.css
@@ -1,10 +1,10 @@
 .button-login {
-  position: absolute;
-  left: 40%;
+  position: relative;
+  left: 45%;
   display: inline-block;
   border: 1px solid #999;
   border-radius: 2px;
-  margin-top: 5px;
+  margin-top: 10px;
   width: 135px;
   height: 25px;
   padding: 0;
diff --git a/test/functional/redmine_oauth_controller_test.rb b/test/functional/redmine_oauth_controller_test.rb
index 757a542..e584dd2 100644
--- a/test/functional/redmine_oauth_controller_test.rb
+++ b/test/functional/redmine_oauth_controller_test.rb
@@ -90,12 +90,27 @@ class RedmineOauthControllerTest < ActionController::TestCase
   end
 
   def test_oauth_google_callback_with_new_user_created_with_manual_activation
-      Setting.self_registration = '2'
-      set_response_body_stub
-      get :oauth_google_callback
-      assert_redirected_to :signin
-      user = User.find_by_mail(@default_user_credentials[:mail])
-      assert user
-      assert_equal User::STATUS_REGISTERED, user.status
+    Setting.self_registration = '2'
+    set_response_body_stub
+    get :oauth_google_callback
+    assert_redirected_to :signin
+    user = User.find_by_mail(@default_user_credentials[:mail])
+    assert user
+    assert_equal User::STATUS_REGISTERED, user.status
+  end
+
+  def test_oauth_google_callback_with_not_allowed_email_domain
+    Setting.plugin_redmine_omniauth_google[:allowed_domains] = "twinslash.com"
+    set_response_body_stub
+    get :oauth_google_callback
+    assert_redirected_to :signin  
+  end
+
+  def test_oauth_google_callback_with_allowed_email_domain
+    Setting.self_registration = '3'
+    Setting.plugin_redmine_omniauth_google[:allowed_domains] = parse_email(@default_response_body[:email])[:domain]
+    set_response_body_stub
+    get :oauth_google_callback
+    assert_redirected_to controller: 'my', action: 'account'
   end
 end
\ No newline at end of file
-- 
GitLab