-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
e1d744e
commit 13bc455
Showing
9 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
= form_with(model: resume, data: { turbo: false }, class: "form-width-avg") do |form| | ||
.form-group.row.mb-15 | ||
= form.label :name | ||
= form.text_field :name, class: "form-control" | ||
.form-group.row.mb-15 | ||
= form.label :description | ||
= form.rich_text_area :description, class: "form-control" | ||
= form.hidden_field :user_id, value: current_user.id | ||
.form-group.mt-10 | ||
= form.submit text, class: "btn btn-outline-success" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
- if @resume.errors.any? | ||
. | ||
h2 Errors | ||
ul | ||
- @resume.errors.each do |error| | ||
li = error.full_message | ||
|
||
= render partial: "form", locals: { resume: @resume, text: "New resume" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.container.d-flex.flex-column.align-items-center | ||
h1 = @resume.name | ||
p.text-break = @resume.description | ||
|
||
.container | ||
.row | ||
.col.text-center.d-flex.justify-content-center | ||
= button_to "Back", resumes_path, method: :get, class: "btn btn-success mx-2" | ||
- if current_user.id == @resume.user_id | ||
= button_to "Edit", edit_resume_path, method: :get, class: "btn btn-primary mx-2" | ||
= button_to "Delete", resume_path(@resume), method: :delete, data: { "turbo-confirm": "Are you sure you want to delete this resume?" }, class: "btn btn-danger mx-2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe ResumePolicy do | ||
let(:user) { build_stubbed(:user, :company) } | ||
let(:resume) { build_stubbed(:resume, user:) } | ||
|
||
let(:policy) { described_class.new(resume, user:) } | ||
|
||
describe "#new?" do | ||
subject { policy.apply(:new?) } | ||
|
||
context "when the user is a company, it returns true" do | ||
it { is_expected.to be true } | ||
end | ||
|
||
context "when the user is admin, it returns false" do | ||
let(:user) { build_stubbed(:user, :admin) } | ||
|
||
it { is_expected.to be false } | ||
end | ||
end | ||
end |