mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-10 16:54:38 -04:00
- 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>
33 lines
826 B
Ruby
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
|