Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mvp interview survey #4549

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/controllers/interview_surveys_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class InterviewSurveysController < ApplicationController
def new
unless Feature.enabled?(:survey_feature, current_user)
redirect_to dashboard_path, notice: 'Feature not enabled'
end
end

def create
# puts params[:survey]
redirect_to dashboard_path, notice: 'Survey Submitted'
end
end
11 changes: 11 additions & 0 deletions app/views/interview_surveys/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%= title('Interview Survey') %>

<div>
<div class="page-container">
<h1 class="page-heading-title">Interview Survey</h1>

<div class='max-w-xl mx-auto'>
<%# where form will be rendered %>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,5 @@

resources :notifications, only: %i[index update]
resource :themes, only: :update
resources :interview_surveys, only: %i[new create]
end
18 changes: 18 additions & 0 deletions db/migrate/20240530151357_change_flipper_gates_value_to_text.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.0]
def up
# Ensure this incremental update migration is idempotent
return unless connection.column_exists? :flipper_gates, :value, :string

if index_exists? :flipper_gates, %i[feature_key key value]
remove_index :flipper_gates, %i[feature_key key value]
end
change_column :flipper_gates, :value, :text
add_index :flipper_gates, %i[feature_key key value], unique: true, length: { value: 255 }
end

def down
change_column :flipper_gates, :value, :string
end
end
4 changes: 2 additions & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions spec/system/interview_survey_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'rails_helper'

RSpec.describe 'Interview survey' do
let(:user) { create(:user) }

before do
sign_in(user)
end

context 'when the feature is enabled' do
before do
Flipper.enable(:survey_feature)
end

it 'shows the survey' do
visit new_interview_survey_path
expect(page).to have_content('Interview Survey')
end
end

context 'when the feature is disabled' do
it 'redirects to the dashboard' do
visit new_interview_survey_path
expect(page).to have_content('Feature not enabled')
expect(page).to have_current_path(dashboard_path)
end
end
end