diff --git a/Jenkinsfile b/Jenkinsfile
index 52a9c505..06f10674 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -11,6 +11,12 @@ if (env.TAG_NAME && env.TAG_NAME.contains("release")) {
kubecSecretsId = 'gl-launcher-staging-secrets'
}
+properties([
+ pipelineTriggers([
+ githubPush()
+ ])
+])
+
podTemplate(label: label, cloud: "${kubeCloud}", containers: [
containerTemplate(name: 'ruby', image: "ruby:2.5.1", command: 'cat', ttyEnabled: true),
containerTemplate(name: 'gcloud', image: "gcr.io/ci-cd-for-bn/gcloud-docker", command: 'cat', ttyEnabled: true),
@@ -31,7 +37,7 @@ volumes: [
stage('Test') {
container('ruby') {
- sh "bundle install && bundle exec rubocop && bundle exec rspec"
+ sh "bundle install --without development production && bundle exec rubocop && bundle exec rspec"
}
}
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a35b39a6..2176cbfb 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base
before_action :set_locale
# Force SSL for loadbalancer configurations.
- before_filter :redirect_to_https
+ before_action :redirect_to_https
protect_from_forgery with: :exception
diff --git a/app/views/shared/components/_recording_row.html.erb b/app/views/shared/components/_recording_row.html.erb
index c567d771..b1489b53 100644
--- a/app/views/shared/components/_recording_row.html.erb
+++ b/app/views/shared/components/_recording_row.html.erb
@@ -38,7 +38,7 @@
<%= t("recording.table.users") %>
- <%= recording[:participants] %>
+ <%= recording[:participants] || "-" %>
diff --git a/config/initializers/version.rb b/config/initializers/version.rb
index 9cb791e3..9933426f 100644
--- a/config/initializers/version.rb
+++ b/config/initializers/version.rb
@@ -2,6 +2,6 @@
module Greenlight
class Application
- VERSION = "2.1.0"
+ VERSION = "2.0.0"
end
end
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 0570036e..e546903f 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -43,6 +43,8 @@ describe UsersController, type: :controller do
end
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
get :new
expect(assigns(:user)).to be_a_new(User)
@@ -50,15 +52,47 @@ describe UsersController, type: :controller do
end
describe "POST #create" do
- it "redirects to user room on succesful create" do
- params = random_valid_user_params
- post :create, params: params
+ context "allow greenlight accounts" do
+ before { allow(Rails.configuration).to receive(:allow_user_signup).and_return(true) }
- u = User.find_by(name: params[:user][:name], email: params[:user][:email])
+ it "redirects to user room on successful create" do
+ params = random_valid_user_params
+ post :create, params: params
- expect(u).to_not be_nil
- expect(u.name).to eql(params[:user][:name])
- expect(response).to redirect_to(room_path(u.main_room))
+ u = User.find_by(name: params[:user][:name], email: params[:user][:email])
+
+ expect(u).to_not be_nil
+ expect(u.name).to eql(params[:user][:name])
+ expect(response).to redirect_to(room_path(u.main_room))
+ end
+
+ it "user saves with greenlight provider" do
+ params = random_valid_user_params
+ post :create, params: params
+
+ u = User.find_by(name: params[:user][:name], email: params[:user][:email])
+
+ expect(u.provider).to eql("greenlight")
+ end
+
+ it "renders #new on unsuccessful save" do
+ post :create, params: invalid_params
+
+ expect(response).to render_template(:new)
+ 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
@@ -68,21 +102,6 @@ describe UsersController, type: :controller do
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
- params = random_valid_user_params
- post :create, params: params
-
- u = User.find_by(name: params[:user][:name], email: params[:user][:email])
-
- expect(u.provider).to eql("greenlight")
- end
-
- it "renders #new on unsuccessful save" do
- post :create, params: invalid_params
-
- expect(response).to render_template(:new)
- end
end
describe "PATCH #update" do
|