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

sk8higher / task-manager / 8708017921

16 Apr 2024 03:06PM UTC coverage: 57.429% (-0.1%) from 57.554%
8708017921

push

github

web-flow
Merge pull request #35 from sk8higher/feature/attachments-frontend

1 of 4 new or added lines in 2 files covered. (25.0%)

20 existing lines in 4 files now uncovered.

201 of 350 relevant lines covered (57.43%)

0.57 hits per line

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

27.5
/app/controllers/api/v1/tasks_controller.rb
1
class Api::V1::TasksController < Api::V1::ApplicationController
1✔
2
  def index
1✔
3
    tasks = Task.all.
×
4
      ransack(ransack_params).
5
      result.
6
      page(page).
7
      per(per_page)
8

9
    respond_with(tasks, each_serializer: TaskSerializer, root: 'items', meta: build_meta(tasks))
×
10
  end
11

12
  def show
1✔
13
    task = Task.find(params[:id])
×
14
    respond_with(task, serializer: TaskSerializer)
×
15
  end
16

17
  def create
1✔
18
    task = current_user.my_tasks.new(task_params)
×
19

20
    if task.save
×
21
      SendTaskCreateNotificationJob.perform_async(task.id)
×
22
    end
23

24
    respond_with(task, serializer: TaskSerializer, location: nil)
×
25
  end
26

27
  def update
1✔
28
    task = Task.find(params[:id])
×
29

30
    if task.update(task_params)
×
31
      SendTaskUpdateNotificationJob.perform_async(task.id)
×
32
    end
33

34
    respond_with(task, serializer: TaskSerializer)
×
35
  end
36

37
  def destroy
1✔
38
    task = Task.find(params[:id])
×
39

40
    if task.destroy
×
41
      SendTaskDestroyNotificationJob.perform_async(task.id)
×
42
    end
43

44
    respond_with(task)
×
45
  end
46

47
  def attach_image
1✔
NEW
48
    task = Task.find(params[:task_id])
×
UNCOV
49
    task_attach_image_form = TaskAttachImageForm.new(attachment_params)
×
50

UNCOV
51
    if task_attach_image_form.invalid?
×
NEW
52
      respond_with(task_attach_image_form)
×
UNCOV
53
      return
×
54
    end
55

UNCOV
56
    image = task_attach_image_form.processed_image
×
UNCOV
57
    task.image.attach(image)
×
58

UNCOV
59
    respond_with(task, serializer: TaskSerializer)
×
60
  end
61

62
  def remove_image
1✔
NEW
63
    task = Task.find(params[:task_id])
×
UNCOV
64
    task.image.purge
×
65

UNCOV
66
    respond_with(task, serializer: TaskSerializer)
×
67
  end
68

69
  private
1✔
70

71
  def task_params
1✔
UNCOV
72
    params.require(:task).permit(:name, :description, :author_id, :assignee_id, :state_event, :expired_at)
×
73
  end
74

75
  def attachment_params
1✔
UNCOV
76
    params.require(:attachment).permit(:image, :crop_x, :crop_y, :crop_height, :crop_width)
×
77
  end
78
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

© 2026 Coveralls, Inc