• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / tigerdata-app / 557af697-cbf1-465d-8d59-306d6d835624

20 May 2025 09:26PM UTC coverage: 85.754% (-0.09%) from 85.846%
557af697-cbf1-465d-8d59-306d6d835624

push

circleci

web-flow
Adding approve button for sysadmin and superusers (#1492)

* Added simple approve button

* WIP fixing the test suite

* Adding tests

* Fixing test suite

* Removed pry

* Fleshed out test suite

4 of 4 branches covered (100.0%)

18 of 24 new or added lines in 3 files covered. (75.0%)

2811 of 3278 relevant lines covered (85.75%)

498.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.31
/app/controllers/requests_controller.rb
1
# frozen_string_literal: true
2
class RequestsController < ApplicationController
1✔
3
  before_action :set_breadcrumbs
1✔
4

5
  # GET /requests
6
  def index
1✔
7
    return head :forbidden unless Flipflop.new_project_request_wizard?
5✔
8
    if current_user.superuser || current_user.sysadmin || current_user.trainer
5✔
9
      add_breadcrumb("New Project Request")
2✔
10
      @requests = Request.all
2✔
11
    else
12
      error_message = "You do not have access to this page."
3✔
13
      flash[:notice] = error_message
3✔
14
      redirect_to dashboard_path
3✔
15
    end
16
  end
17

18
  def show
1✔
19
    if current_user.superuser || current_user.sysadmin || current_user.trainer
5✔
20
      @request = Request.find(params[:id])
2✔
21
      add_breadcrumb("Requests", requests_path)
2✔
22
      add_breadcrumb(@request.project_title, request_path)
2✔
23
      render :show
2✔
24
    else
25
      error_message = "You do not have access to this page."
3✔
26
      flash[:notice] = error_message
3✔
27
      redirect_to dashboard_path
3✔
28
    end
29
  end
30

31
  def approve
1✔
NEW
32
    if current_user.superuser || current_user.sysadmin || current_user.trainer
×
NEW
33
      stub_message = "Edit the 'approve' method in app/controllers/requests_controller.rb to do something when this button is clicked"
×
NEW
34
      redirect_to dashboard_path, notice: stub_message
×
35
    else
NEW
36
      error_message = "You do not have access to this page."
×
NEW
37
      flash[:notice] = error_message
×
NEW
38
      redirect_to dashboard_path
×
39
    end
40
  end
41

42
  private
1✔
43

44
    def set_breadcrumbs
1✔
45
      add_breadcrumb("Dashboard", dashboard_path)
10✔
46
    end
47
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc