Merge pull request #4400 from consul/dependabot/bundler/view_component-2.28.0

Bump view_component from 2.19.1 to 2.28.0
This commit is contained in:
Javi Martín
2021-08-10 21:19:35 +02:00
committed by GitHub
9 changed files with 14 additions and 32 deletions

View File

@@ -59,7 +59,7 @@ gem "translator-text", "~> 0.1.0"
gem "turbolinks", "~> 5.2.1"
gem "turnout", "~> 2.5.0"
gem "uglifier", "~> 4.2.0"
gem "view_component", "~> 2.19.1", require: "view_component/engine"
gem "view_component", "~> 2.28.0", require: "view_component/engine"
gem "whenever", "~> 1.0.0", require: false
gem "wicked_pdf", "~> 2.1.0"
gem "wkhtmltopdf-binary", "~> 0.12.4"

View File

@@ -661,7 +661,7 @@ GEM
uniform_notifier (1.14.2)
user_agent_parser (2.6.0)
uuidtools (2.1.5)
view_component (2.19.1)
view_component (2.28.0)
activesupport (>= 5.0.0, < 7.0)
warden (1.2.9)
rack (>= 2.0.9)
@@ -789,7 +789,7 @@ DEPENDENCIES
turbolinks (~> 5.2.1)
turnout (~> 2.5.0)
uglifier (~> 4.2.0)
view_component (~> 2.19.1)
view_component (~> 2.28.0)
web-console (~> 3.7.0)
webdrivers (~> 4.4.1)
whenever (~> 1.0.0)

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe Admin::Budgets::IndexComponent, type: :component do
describe Admin::Budgets::IndexComponent, type: :component, controller: Admin::BudgetsController do
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BudgetsController")
allow_any_instance_of(Admin::BudgetsController).to receive(:valid_filters).and_return(["all"])
allow_any_instance_of(Admin::BudgetsController).to receive(:current_filter).and_return("all")
end

View File

@@ -1,13 +1,9 @@
require "rails_helper"
describe Admin::Budgets::TableActionsComponent, type: :component do
describe Admin::Budgets::TableActionsComponent, type: :component, controller: Admin::BaseController do
let(:budget) { create(:budget) }
let(:component) { Admin::Budgets::TableActionsComponent.new(budget) }
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BaseController")
end
it "renders links to edit and delete budget, manage investments and edit groups and manage ballots" do
render_inline component

View File

@@ -1,15 +1,11 @@
require "rails_helper"
describe Admin::Poll::Officers::OfficersComponent, type: :component do
describe Admin::Poll::Officers::OfficersComponent, type: :component, controller: Admin::BaseController do
let(:existing_officer) { create(:poll_officer, name: "Old officer") }
let(:new_officer) { build(:poll_officer, name: "New officer") }
let(:officers) { [existing_officer, new_officer] }
let(:component) { Admin::Poll::Officers::OfficersComponent.new(officers) }
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BaseController")
end
it "renders as many rows as officers" do
render_inline component

View File

@@ -1,12 +1,8 @@
require "rails_helper"
describe Admin::Roles::TableActionsComponent, type: :component do
describe Admin::Roles::TableActionsComponent, type: :component, controller: Admin::BaseController do
let(:user) { create(:user) }
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BaseController")
end
it "renders link to add the role for new records" do
render_inline Admin::Roles::TableActionsComponent.new(user.build_manager)

View File

@@ -1,12 +1,8 @@
require "rails_helper"
describe Admin::TableActionsComponent, type: :component do
describe Admin::TableActionsComponent, type: :component, controller: Admin::BaseController do
let(:record) { create(:banner) }
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("Admin::BaseController")
end
it "renders links to edit and destroy a record by default" do
render_inline Admin::TableActionsComponent.new(record)
@@ -71,11 +67,7 @@ describe Admin::TableActionsComponent, type: :component do
end
context "different namespace" do
before do
allow(ViewComponent::Base).to receive(:test_controller).and_return("SDGManagement::BaseController")
end
it "generates links to different namespaces" do
it "generates links to different namespaces", controller: SDGManagement::BaseController do
render_inline Admin::TableActionsComponent.new(create(:sdg_local_target))
expect(page).to have_css "a", count: 2

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe SDGManagement::Relations::IndexComponent, type: :component do
describe SDGManagement::Relations::IndexComponent, type: :component, controller: SDGManagement::RelationsController 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)

View File

@@ -80,6 +80,10 @@ RSpec.configure do |config|
sign_in(create(:administrator).user)
end
config.around(:each, :controller, type: :component) do |example|
with_controller_class(example.metadata[:controller]) { example.run }
end
config.before(:each, :show_exceptions) do
config = Rails.application.env_config