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

pulibrary / oawaiver / 40ca2f09-e694-44a5-b909-7cce179b9e67

11 Jul 2024 05:42PM UTC coverage: 0.0% (-80.4%) from 80.383%
40ca2f09-e694-44a5-b909-7cce179b9e67

push

circleci

jrgriffiniii
Trying to expand the RSpec test suite for EmployeesController#ajax_search

0 of 1206 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/app/api/ajax_query/employees.rb
1
# frozen_string_literal: true
2

3
require "rack/contrib"
×
4

5
module AjaxQuery
×
6
  class Employees < Grape::API
×
7
    use Rack::JSONP
×
8

9
    helpers do
×
10
      def current_user
×
11
        @current_user ||= User.authorize!(env)
×
12
      end
×
13
    end
×
14

15
    rescue_from :all do |error|
×
16
      error_response({ errors: [error.message] })
×
17
    end
×
18

19
    # GET /get/:id
20
    desc "return the employee with the record ID"
×
21
    params do
×
22
      requires :id, type: String, desc: "record ID"
×
23
    end
×
24
    get "get/unique_id" do
×
25
      unique_id = params[:id]
×
26
      model = Employee.find_by(unique_id:)
×
27

28
      present(model, with: Entities::Employees, type: :full)
×
29
    end
×
30

31
    # GET /get/:net_id
32
    desc "return the employee with matching NetID"
×
33
    params do
×
34
      requires :netid, type: String, desc: "exact netid"
×
35
    end
×
36
    get "get/netid" do
×
37
      netid = params[:netid]
×
38
      model = Employee.find_by(netid:)
×
39

40
      present(model, with: Entities::Employees, type: :full)
×
41
    end
×
42

43
    # GET /get_all/name/:search_term
44
    desc "find all Employees with a matching name"
×
45
    params do
×
46
      requires(:search_term, type: String, desc: "partial name")
×
47
    end
×
48
    get "get_all/name" do
×
49
      search_term_param = params[:search_term]
×
50
      query = Employee.all_by_name(search_term_param)
×
51
      results = query.results
×
52

53
      present(results, with: Entities::Employees, type: :full)
×
54
    end
×
55

56
    # GET /get_all/department/:search_term
57
    desc "return all employees from given department"
×
58
    params do
×
59
      requires :search_term, type: String, desc: "partial department name"
×
60
    end
×
61
    get "get_all/department" do
×
62
      search_term_param = params[:search_term]
×
63
      query = Employee.all_by_department(search_term_param)
×
64
      results = query.results
×
65

66
      present(results, with: Entities::Employees)
×
67
    end
×
68
  end
×
69
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