Infer type for component specs automatically

This commit is contained in:
Javi Martín
2021-08-17 22:07:39 +02:00
parent e5cd763385
commit 4cbf945228
51 changed files with 54 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Budgets::DurationComponent, type: :component do
describe Admin::Budgets::DurationComponent do
describe "#dates" do
it "shows both dates when both are defined" do
durable = double(

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Budgets::FormComponent, type: :component do
describe Admin::Budgets::FormComponent do
describe "#voting_styles_select_options" do
it "provides vote kinds" do
types = [["Knapsack", "knapsack"], ["Approval", "approval"]]

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Budgets::IndexComponent, type: :component, controller: Admin::BudgetsController do
describe Admin::Budgets::IndexComponent, controller: Admin::BudgetsController do
before do
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")

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Budgets::TableActionsComponent, type: :component, controller: Admin::BaseController do
describe Admin::Budgets::TableActionsComponent, controller: Admin::BaseController do
let(:budget) { create(:budget) }
let(:component) { Admin::Budgets::TableActionsComponent.new(budget) }

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::BudgetsWizard::Headings::GroupSwitcherComponent, type: :component do
describe Admin::BudgetsWizard::Headings::GroupSwitcherComponent do
it "is not rendered for budgets with one group" do
group = create(:budget_group, budget: create(:budget))

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::HiddenTableActionsComponent, type: :component do
describe Admin::HiddenTableActionsComponent do
let(:record) { create(:user) }
let(:component) { Admin::HiddenTableActionsComponent.new(record) }

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Organizations::TableActionsComponent, type: :component do
describe Admin::Organizations::TableActionsComponent do
let(:organization) { create(:organization) }
let(:component) { Admin::Organizations::TableActionsComponent.new(organization) }

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Poll::Officers::OfficersComponent, type: :component, controller: Admin::BaseController do
describe Admin::Poll::Officers::OfficersComponent, 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] }

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Poll::Questions::FilterComponent, type: :component do
describe Admin::Poll::Questions::FilterComponent do
it "renders a button to submit the form" do
render_inline Admin::Poll::Questions::FilterComponent.new([])

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Roles::TableActionsComponent, type: :component, controller: Admin::BaseController do
describe Admin::Roles::TableActionsComponent, controller: Admin::BaseController do
let(:user) { create(:user) }
it "renders link to add the role for new records" do

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::Stats::SDG::GoalComponent, type: :component do
describe Admin::Stats::SDG::GoalComponent do
let(:component) { Admin::Stats::SDG::GoalComponent.new(goal: goal) }
let(:goal) { SDG::Goal.sample }

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe Admin::TableActionsComponent, type: :component, controller: Admin::BaseController do
describe Admin::TableActionsComponent, controller: Admin::BaseController do
let(:record) { create(:banner) }
it "renders links to edit and destroy a record by default" do