Files
grecia/spec/components/sdg_management/relations/index_component_spec.rb
Javi Martín 5f3279b9db Extract search form component in SDG Management
We're going to add some JavaScript which affect this component, and IMHO
it will be easier to know the JavaScript affects this form if both have
their own separate file.
2021-01-28 13:41:23 +01:00

22 lines
856 B
Ruby

require "rails_helper"
describe SDGManagement::Relations::IndexComponent, type: :component do
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("SDGManagement::RelationsController")
allow_any_instance_of(SDGManagement::RelationsController).to receive(:valid_filters)
.and_return(SDGManagement::RelationsController::FILTERS)
allow_any_instance_of(SDGManagement::RelationsController).to receive(:current_filter)
.and_return(SDGManagement::RelationsController::FILTERS.first)
allow_any_instance_of(ApplicationHelper).to receive(:current_path_with_query_params)
.and_return("/anything")
end
it "renders the search form" do
component = SDGManagement::Relations::IndexComponent.new(Proposal.none.page(1))
render_inline component
expect(page).to have_css "form.complex"
end
end