Skip to content

Commit

Permalink
fix leave spec
Browse files Browse the repository at this point in the history
  • Loading branch information
JensRavens committed Jun 25, 2024
1 parent 652349b commit 1d94544
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ node_modules

*.env
/public/vite-dev
/public/vite-test
2 changes: 1 addition & 1 deletion app/views/leaves/_leave.html.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.card
.card id="leave_#{leave.id}"
- leave = Leave::Presenter.new(leave)

.card__header
Expand Down
9 changes: 7 additions & 2 deletions spec/system/leaves_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
click_on "Request leave"
within ".modal" do
select("February")
expect(page).to have_selector ".cur-year"
find("input", class: "cur-year").set ""
find("input", class: "cur-year").send_keys "2", "0", "2", "2"
find("span", text: "18").click
find("span", text: "21").click
Expand All @@ -35,13 +37,16 @@
end

it "approves a requested leave" do
users(:john).leaves.create! title: "Holiday", type: :paid, days: ["2025-01-01"]
leave = users(:john).leaves.create! title: "Holiday", type: :paid, days: ["2025-01-01"]
login :admin
visit leaves_path
expect(page).to have_content "John / Holiday"
expect(page).to have_content "pending approval"
screenshot "leave approval"
click_on "👍", match: :first
within "#leave_#{leave.id}" do
click_on "👍"
expect(page).not_to have_content "👍"
end
message = Slack.instance.last_message
expect(message.channel).to eq "slack-john"
expect(message.text).to include "approved"
Expand Down

0 comments on commit 1d94544

Please sign in to comment.