Files
openfoodnetwork/spec/reflexes/user_reflex_spec.rb
David Cook 854091eb9c Bump stimulus_reflex_testing to latest
It contains a fix for stimulus_reflex 3.5.0-rc4, but hasn't been released yet.
https://github.com/podia/stimulus_reflex_testing/issues/21

Now the user reflex spec works, but the products spec needs another fix. But we plan to remove it soon anyway.
2024-05-14 14:23:20 +10:00

24 lines
718 B
Ruby

# frozen_string_literal: true
require "reflex_helper"
RSpec.describe UserReflex, type: :reflex do
let(:current_user) { create(:user) }
let(:context) { { url: spree.admin_dashboard_url, connection: { current_user: } } }
describe "#accept_terms_of_services" do
subject(:reflex) { build_reflex(method_name: :accept_terms_of_services, **context) }
it "updates terms_of_service_accepted_at" do
expect {
reflex.run(:accept_terms_of_services)
current_user.reload
}.to change{ current_user.terms_of_service_accepted_at }
end
it "removes banner from the page" do
expect(reflex.run(:accept_terms_of_services)).to morph("#banner-container").with("")
end
end
end