Files
growstuff/spec/features/shared_examples/append_date.rb
google-labs-jules[bot] 6c7903c2a5 Fix RSpec/ExpectInHook offenses
- Move expectations from `before` hooks to `it` blocks.
- Ensure controller actions are called after expectations are set in controller specs.
- Replace synchronization expectations in hooks with Capybara `find` calls.
- Remove RSpec/ExpectInHook from .rubocop_todo.yml.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-04-25 18:39:43 +00:00

33 lines
826 B
Ruby

# frozen_string_literal: true
shared_examples "append date" do
let(:this_month) { Time.zone.today.strftime("%b") }
let(:this_year) { Time.zone.today.year }
before { visit path }
describe "Selecting a date with datepicker" do
before do
click_link 'Actions'
click_link link_text
within "div.datepicker" do
find(".datepicker-days", text: this_month.to_s)
find(".datepicker-days td.day", text: "21").click
end
end
it { expect(page).to have_content "Finished" }
it { expect(page).to have_content "#{this_month} #{this_year}" }
end
describe "Confirming without selecting date" do
before do
click_link 'Actions'
click_link link_text
click_link "Confirm without date"
end
it { expect(page).to have_content("Finished") }
end
end