forked from External/greenlight
		
	This commit is contained in:
		@@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base
 | 
				
			|||||||
  before_action :set_locale
 | 
					  before_action :set_locale
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Force SSL for loadbalancer configurations.
 | 
					  # Force SSL for loadbalancer configurations.
 | 
				
			||||||
  before_filter :redirect_to_https
 | 
					  before_action :redirect_to_https
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protect_from_forgery with: :exception
 | 
					  protect_from_forgery with: :exception
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@
 | 
				
			|||||||
    <div class="small text-muted text-uppercase">
 | 
					    <div class="small text-muted text-uppercase">
 | 
				
			||||||
      <%= t("recording.table.users") %>
 | 
					      <%= t("recording.table.users") %>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <%= recording[:participants] %>
 | 
					    <%= recording[:participants] || "-" %>
 | 
				
			||||||
  </td>
 | 
					  </td>
 | 
				
			||||||
  <td class="text-left">
 | 
					  <td class="text-left">
 | 
				
			||||||
    <div class="dropdown">
 | 
					    <div class="dropdown">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
module Greenlight
 | 
					module Greenlight
 | 
				
			||||||
  class Application
 | 
					  class Application
 | 
				
			||||||
    VERSION = "2.1.0"
 | 
					    VERSION = "2.0.0"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,6 +43,8 @@ describe UsersController, type: :controller do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "GET #new" do
 | 
					  describe "GET #new" do
 | 
				
			||||||
 | 
					    before { allow(Rails.configuration).to receive(:allow_user_signup).and_return(true) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it "assigns a blank user to the view" do
 | 
					    it "assigns a blank user to the view" do
 | 
				
			||||||
      get :new
 | 
					      get :new
 | 
				
			||||||
      expect(assigns(:user)).to be_a_new(User)
 | 
					      expect(assigns(:user)).to be_a_new(User)
 | 
				
			||||||
@@ -50,7 +52,10 @@ describe UsersController, type: :controller do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "POST #create" do
 | 
					  describe "POST #create" do
 | 
				
			||||||
    it "redirects to user room on succesful create" do
 | 
					    context "allow greenlight accounts" do
 | 
				
			||||||
 | 
					      before { allow(Rails.configuration).to receive(:allow_user_signup).and_return(true) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      it "redirects to user room on successful create" do
 | 
				
			||||||
        params = random_valid_user_params
 | 
					        params = random_valid_user_params
 | 
				
			||||||
        post :create, params: params
 | 
					        post :create, params: params
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -61,14 +66,6 @@ describe UsersController, type: :controller do
 | 
				
			|||||||
        expect(response).to redirect_to(room_path(u.main_room))
 | 
					        expect(response).to redirect_to(room_path(u.main_room))
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it "redirects to main room if already authenticated" do
 | 
					 | 
				
			||||||
      user = create(:user)
 | 
					 | 
				
			||||||
      @request.session[:user_id] = user.id
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      post :create, params: random_valid_user_params
 | 
					 | 
				
			||||||
      expect(response).to redirect_to(room_path(user.main_room))
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      it "user saves with greenlight provider" do
 | 
					      it "user saves with greenlight provider" do
 | 
				
			||||||
        params = random_valid_user_params
 | 
					        params = random_valid_user_params
 | 
				
			||||||
        post :create, params: params
 | 
					        post :create, params: params
 | 
				
			||||||
@@ -85,6 +82,28 @@ describe UsersController, type: :controller do
 | 
				
			|||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    context "disallow greenlight accounts" do
 | 
				
			||||||
 | 
					      before { allow(Rails.configuration).to receive(:allow_user_signup).and_return(false) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      it "redirect to root on attempted create" do
 | 
				
			||||||
 | 
					        params = random_valid_user_params
 | 
				
			||||||
 | 
					        post :create, params: params
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        u = User.find_by(name: params[:user][:name], email: params[:user][:email])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        expect(u).to be_nil
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it "redirects to main room if already authenticated" do
 | 
				
			||||||
 | 
					      user = create(:user)
 | 
				
			||||||
 | 
					      @request.session[:user_id] = user.id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      post :create, params: random_valid_user_params
 | 
				
			||||||
 | 
					      expect(response).to redirect_to(room_path(user.main_room))
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "PATCH #update" do
 | 
					  describe "PATCH #update" do
 | 
				
			||||||
    it "properly updates user attributes" do
 | 
					    it "properly updates user attributes" do
 | 
				
			||||||
      user = create(:user)
 | 
					      user = create(:user)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user