diff --git a/.gitignore b/.gitignore index 4eecd68..4413cf8 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ node_modules *.env /public/vite-dev +/public/vite-test diff --git a/app/views/leaves/_leave.html.slim b/app/views/leaves/_leave.html.slim index 8c824f4..c8fdac9 100644 --- a/app/views/leaves/_leave.html.slim +++ b/app/views/leaves/_leave.html.slim @@ -1,4 +1,4 @@ -.card +.card id="leave_#{leave.id}" - leave = Leave::Presenter.new(leave) .card__header diff --git a/spec/system/leaves_spec.rb b/spec/system/leaves_spec.rb index 2156cc0..5d701c0 100644 --- a/spec/system/leaves_spec.rb +++ b/spec/system/leaves_spec.rb @@ -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 @@ -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"