2022-01-02 15:31:55 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-01-16 09:38:06 -08:00
|
|
|
RSpec.shared_examples_for "raises an error" do |error_klass|
|
|
|
|
it "raises an error" do
|
|
|
|
expect { subject }.to raise_error(kind_of(error_klass))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-01-02 15:31:55 -08:00
|
|
|
RSpec.shared_examples_for "ajax does not succeed" do |part_of_error_message|
|
|
|
|
it "ajax does not succeed" do
|
|
|
|
subject
|
|
|
|
expect(assigns(:response)[:success]).to be false
|
|
|
|
expect(assigns(:response)[:message]).to include(part_of_error_message)
|
|
|
|
end
|
|
|
|
end
|
2023-10-26 12:39:47 -07:00
|
|
|
|
2023-10-26 13:43:01 -07:00
|
|
|
RSpec.shared_examples_for "turbo does not succeed" do |part_of_error_message|
|
2023-10-26 12:39:47 -07:00
|
|
|
it "turbo does not succeed" do
|
|
|
|
subject
|
2023-10-26 13:43:01 -07:00
|
|
|
expect(response.body).to include(part_of_error_message)
|
2023-10-26 12:39:47 -07:00
|
|
|
end
|
|
|
|
end
|