diff --git a/app/components/button_component.rb b/app/components/button_component.rb index f74d0769e..3a6ff6ea5 100644 --- a/app/components/button_component.rb +++ b/app/components/button_component.rb @@ -4,7 +4,7 @@ class ButtonComponent < ApplicationComponent VARIANTS = %i[default primary secondary success danger warning info light dark link outline_primary].freeze SIZES = %i[sm default lg].freeze - def initialize(title:, url:, variant: :default, size: :default, icon: nil, is_responsive: false, extra_classes: "", **html_options) # rubocop:disable Metrics/ParameterLists + def initialize(title, url:, variant: :default, size: :default, icon: nil, is_responsive: false, extra_classes: "", **html_options) # rubocop:disable Metrics/ParameterLists @title = title @url = url @variant = variant&.to_sym diff --git a/app/components/page/heading_edit_component.rb b/app/components/page/heading_edit_component.rb index 84aafd77a..bec4d7773 100644 --- a/app/components/page/heading_edit_component.rb +++ b/app/components/page/heading_edit_component.rb @@ -15,7 +15,7 @@ def initialize(resource:, title:, breadcrumb_steps:) def call render HeadingComponent.new(title: @title, breadcrumb_steps: @breadcrumb_steps) do |heading| heading.with_left_content do - render ButtonComponent.new(title: t("action.back"), + render ButtonComponent.new(t("action.back"), url: polymorphic_url(@resource.class), icon: "chevron-left", is_responsive: true) @@ -25,7 +25,7 @@ def call tag.div class: "align-self-center d-inline-flex" do concat(extra_buttons) if extra_buttons? - concat(render(ButtonComponent.new(title: t("action.show"), + concat(render(ButtonComponent.new(t("action.show"), url: @resource, variant: :primary, icon: "eye", diff --git a/app/components/page/heading_new_component.rb b/app/components/page/heading_new_component.rb index 24e8ef45e..039b12b16 100644 --- a/app/components/page/heading_new_component.rb +++ b/app/components/page/heading_new_component.rb @@ -14,7 +14,7 @@ def call render HeadingComponent.new(title: @title, breadcrumb_steps: @breadcrumb_steps) do |heading| heading.with_left_content do tag.span class: "flex-grow-1" do - render ButtonComponent.new(title: t("action.back"), + render ButtonComponent.new(t("action.back"), url: polymorphic_url(@resource.class), icon: "chevron-left", is_responsive: true) diff --git a/app/components/page/heading_show_component.rb b/app/components/page/heading_show_component.rb index 123563d73..0190f0fa4 100644 --- a/app/components/page/heading_show_component.rb +++ b/app/components/page/heading_show_component.rb @@ -15,7 +15,7 @@ def initialize(resource:, title:, breadcrumb_steps:) def call render HeadingComponent.new(title: @title, breadcrumb_steps: @breadcrumb_steps) do |heading| heading.with_left_content do - render ButtonComponent.new(title: t("action.back"), + render ButtonComponent.new(t("action.back"), url: polymorphic_url(@resource.class), icon: "chevron-left", is_responsive: true) @@ -25,7 +25,7 @@ def call tag.div class: "align-self-center d-inline-flex" do concat(extra_buttons) if extra_buttons? - concat(render(ButtonComponent.new(title: t("action.edit"), + concat(render(ButtonComponent.new(t("action.edit"), url: [:edit, @resource], variant: :info, icon: "pencil", diff --git a/app/views/air_conditioners/index.html.erb b/app/views/air_conditioners/index.html.erb index 27c8ecc5b..78c508793 100644 --- a/app/views/air_conditioners/index.html.erb +++ b/app/views/air_conditioners/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_air_conditioner"), + <% render ButtonComponent.new(t(".new_air_conditioner"), url: new_air_conditioner_path, variant: :success, icon: "plus-lg", diff --git a/app/views/architectures/index.html.erb b/app/views/architectures/index.html.erb index c62d57afb..cf907299a 100644 --- a/app/views/architectures/index.html.erb +++ b/app/views/architectures/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_architecture"), + <% render ButtonComponent.new(t(".new_architecture"), url: new_architecture_path, variant: :success, icon: "plus-lg", diff --git a/app/views/bays/index.html.erb b/app/views/bays/index.html.erb index 6b85209bd..744e0254b 100644 --- a/app/views/bays/index.html.erb +++ b/app/views/bays/index.html.erb @@ -6,7 +6,7 @@ <%= render Page::HeadingComponent.new(title: t(".title"), breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_bay"), + <% render ButtonComponent.new(t(".new_bay"), url: new_bay_path, variant: :success, icon: "plus-lg", diff --git a/app/views/bays/show.html.erb b/app/views/bays/show.html.erb index 8bd8d75c9..39b87aa76 100644 --- a/app/views/bays/show.html.erb +++ b/app/views/bays/show.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingShowComponent.new(resource: @bay, title:, breadcrumb_steps:) do |heading| %> <% heading.with_extra_buttons do %> - <% render ButtonComponent.new(title: t("visualization.title"), + <% render ButtonComponent.new(t("visualization.title"), url: visualization_bay_path(@bay), variant: :primary, icon: "diagram-3-fill", diff --git a/app/views/card_types/index.html.erb b/app/views/card_types/index.html.erb index 77f09bb4d..21dd2387f 100644 --- a/app/views/card_types/index.html.erb +++ b/app/views/card_types/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_card_type"), + <% render ButtonComponent.new(t(".new_card_type"), url: new_card_type_path, variant: :success, icon: "plus-lg", diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb index f4e043e98..f52de4bdf 100644 --- a/app/views/categories/index.html.erb +++ b/app/views/categories/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_category"), + <% render ButtonComponent.new(t(".new_category"), url: new_category_path, variant: :success, icon: "plus-lg", diff --git a/app/views/changelog_entries/show.html.erb b/app/views/changelog_entries/show.html.erb index b80c8957b..ad8bff625 100644 --- a/app/views/changelog_entries/show.html.erb +++ b/app/views/changelog_entries/show.html.erb @@ -11,7 +11,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_left_content do %> - <%= render ButtonComponent.new(title: t("action.back"), + <%= render ButtonComponent.new(t("action.back"), url: changelog_entries_path, icon: "chevron-left", is_responsive: true) %> diff --git a/app/views/clusters/index.html.erb b/app/views/clusters/index.html.erb index 23db8384c..c3ba2ea7b 100644 --- a/app/views/clusters/index.html.erb +++ b/app/views/clusters/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_cluster"), + <% render ButtonComponent.new(t(".new_cluster"), url: new_cluster_path, variant: :success, icon: "plus-lg", diff --git a/app/views/connections/edit.html.erb b/app/views/connections/edit.html.erb index 34e3502a2..37791e71e 100644 --- a/app/views/connections/edit.html.erb +++ b/app/views/connections/edit.html.erb @@ -11,7 +11,7 @@ <%= render Page::HeadingComponent.new(title: t(".title"), breadcrumb_steps:) do |heading| %> <% heading.with_left_content do %> - <% render ButtonComponent.new(title: t("action.back"), + <% render ButtonComponent.new(t("action.back"), url: connections_path, icon: "chevron-left", is_responsive: true) %> @@ -19,7 +19,7 @@ <% heading.with_right_content do %> <% if @cable %> - <% render ButtonComponent.new(title: t("action.delete"), + <% render ButtonComponent.new(t("action.delete"), url: cable_path(id: @cable.id, redirect_to_port_id: @from_port.id), variant: :danger, icon: "trash", diff --git a/app/views/contract_types/index.html.erb b/app/views/contract_types/index.html.erb index d0764e5ec..cb7793f99 100644 --- a/app/views/contract_types/index.html.erb +++ b/app/views/contract_types/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_contract_type"), + <% render ButtonComponent.new(t(".new_contract_type"), url: new_contract_type_path, variant: :success, icon: "plus-lg", diff --git a/app/views/disk_types/index.html.erb b/app/views/disk_types/index.html.erb index 0bf35e56e..a54bfc305 100644 --- a/app/views/disk_types/index.html.erb +++ b/app/views/disk_types/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_disk_type"), + <% render ButtonComponent.new(t(".new_disk_type"), url: new_disk_type_path, variant: :success, icon: "plus-lg", diff --git a/app/views/domaines/index.html.erb b/app/views/domaines/index.html.erb index ae1ca3ba1..71180d1f3 100644 --- a/app/views/domaines/index.html.erb +++ b/app/views/domaines/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_domaine"), + <% render ButtonComponent.new(t(".new_domaine"), url: new_domaine_path, variant: :success, icon: "plus-lg", diff --git a/app/views/frames/index.html.erb b/app/views/frames/index.html.erb index e83c2d57b..74991b73d 100644 --- a/app/views/frames/index.html.erb +++ b/app/views/frames/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_frame"), + <% render ButtonComponent.new(t(".new_frame"), url: new_frame_path, variant: :success, icon: "plus-lg", diff --git a/app/views/frames/show.html.erb b/app/views/frames/show.html.erb index c5f213b7a..83ecbdf47 100644 --- a/app/views/frames/show.html.erb +++ b/app/views/frames/show.html.erb @@ -7,7 +7,7 @@ resource: @frame, title: t(".title", frame: @frame.name), breadcrumb_steps: ) do |heading| %> <% heading.with_extra_buttons do %> - <% render ButtonComponent.new(title: t("visualization.title"), + <% render ButtonComponent.new(t("visualization.title"), url: visualization_frame_path(@frame), variant: :primary, icon: "diagram-3-fill", diff --git a/app/views/gestions/index.html.erb b/app/views/gestions/index.html.erb index 9fa81c310..a0d51d690 100644 --- a/app/views/gestions/index.html.erb +++ b/app/views/gestions/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_gestion"), + <% render ButtonComponent.new(t(".new_gestion"), url: new_gestion_path, variant: :success, icon: "plus-lg", diff --git a/app/views/islets/index.html.erb b/app/views/islets/index.html.erb index c468a75ee..30f653c76 100644 --- a/app/views/islets/index.html.erb +++ b/app/views/islets/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_islet"), + <% render ButtonComponent.new(t(".new_islet"), url: new_islet_path, variant: :success, icon: "plus-lg", diff --git a/app/views/maintainers/index.html.erb b/app/views/maintainers/index.html.erb index 691f8696e..2f7515b00 100644 --- a/app/views/maintainers/index.html.erb +++ b/app/views/maintainers/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_maintainer"), + <% render ButtonComponent.new(t(".new_maintainer"), url: new_maintainer_path, variant: :success, icon: "plus-lg", diff --git a/app/views/manufacturers/index.html.erb b/app/views/manufacturers/index.html.erb index fe2db04fa..f7bfed371 100644 --- a/app/views/manufacturers/index.html.erb +++ b/app/views/manufacturers/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_manufacturer"), + <% render ButtonComponent.new(t(".new_manufacturer"), url: new_manufacturer_path, variant: :success, icon: "plus-lg", diff --git a/app/views/memory_types/index.html.erb b/app/views/memory_types/index.html.erb index ac4cb7eed..44b511d74 100644 --- a/app/views/memory_types/index.html.erb +++ b/app/views/memory_types/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_memory_type"), + <% render ButtonComponent.new(t(".new_memory_type"), url: new_memory_type_path, variant: :success, icon: "plus-lg", diff --git a/app/views/modeles/index.html.erb b/app/views/modeles/index.html.erb index 46b1a7243..618fd1dbf 100644 --- a/app/views/modeles/index.html.erb +++ b/app/views/modeles/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_modele"), + <% render ButtonComponent.new(t(".new_modele"), url: new_modele_path, variant: :success, icon: "plus-lg", diff --git a/app/views/moves/frame.html.erb b/app/views/moves/frame.html.erb index b35fc53a0..08509d475 100644 --- a/app/views/moves/frame.html.erb +++ b/app/views/moves/frame.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title: t(".title", frame: @frame), breadcrumb_steps:) do |heading| %> <% heading.with_left_content do %> - <%= render ButtonComponent.new(title: t("action.back"), + <%= render ButtonComponent.new(t("action.back"), url: moves_path, icon: "chevron-left", is_responsive: true) %> diff --git a/app/views/moves/index.html.erb b/app/views/moves/index.html.erb index 7945f2fd1..1d2ee19f9 100644 --- a/app/views/moves/index.html.erb +++ b/app/views/moves/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_move"), + <% render ButtonComponent.new(t(".new_move"), url: new_move_path, variant: :success, icon: "plus-lg", diff --git a/app/views/port_types/index.html.erb b/app/views/port_types/index.html.erb index daf998ae1..931c9e06f 100644 --- a/app/views/port_types/index.html.erb +++ b/app/views/port_types/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_port_type"), + <% render ButtonComponent.new(t(".new_port_type"), url: new_port_type_path, variant: :success, icon: "plus-lg", diff --git a/app/views/rooms/index.html.erb b/app/views/rooms/index.html.erb index 43fa6c129..d7c717ab6 100644 --- a/app/views/rooms/index.html.erb +++ b/app/views/rooms/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title: title, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_room"), + <% render ButtonComponent.new(t(".new_room"), url: new_room_path, variant: :success, icon: "plus-lg", diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb index d0721a236..c8c1c5b34 100644 --- a/app/views/rooms/show.html.erb +++ b/app/views/rooms/show.html.erb @@ -11,7 +11,7 @@ title: "#{Room.model_name.human} #{@room.name}", breadcrumb_steps:) do |heading| %> <%= heading.with_extra_buttons do %> - <% render ButtonComponent.new(title: t("visualization.title"), + <% render ButtonComponent.new(t("visualization.title"), url: visualization_room_path(@room), variant: :primary, icon: "diagram-3-fill", diff --git a/app/views/servers/import_csv.html.erb b/app/views/servers/import_csv.html.erb index aad818256..7ce682259 100644 --- a/app/views/servers/import_csv.html.erb +++ b/app/views/servers/import_csv.html.erb @@ -8,7 +8,7 @@ <%= render Page::HeadingComponent.new(title: t(".title"), breadcrumb_steps:) do |heading| %> <% heading.with_left_content do %> - <%= render ButtonComponent.new(title: t("action.back"), + <%= render ButtonComponent.new(t("action.back"), url: servers_path, icon: "chevron-left", is_responsive: true) %> diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb index 116c9a034..d414ca22e 100644 --- a/app/views/servers/index.html.erb +++ b/app/views/servers/index.html.erb @@ -3,19 +3,19 @@ <%= render Page::HeadingComponent.new(title: t(".title"), breadcrumb_steps: { t(".title") => "" } ) do |heading| %> <% heading.with_right_content do %>
- <%= render ButtonComponent.new(title: t(".sync_with_external_apps"), + <%= render ButtonComponent.new(t(".sync_with_external_apps"), url: external_app_records_path, variant: :primary, icon: "arrow-repeat", is_responsive: true) %> - <%= render ButtonComponent.new(title: t(".add_server_via_csv"), + <%= render ButtonComponent.new(t(".add_server_via_csv"), url: import_csv_servers_path, variant: :success, icon: "filetype-csv", is_responsive: true) %> - <%= render ButtonComponent.new(title: t(".new_server"), + <%= render ButtonComponent.new(t(".new_server"), url: new_server_path, variant: :success, icon: "plus-lg", diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb index 6ef8bda18..d6dae85bb 100644 --- a/app/views/servers/show.html.erb +++ b/app/views/servers/show.html.erb @@ -8,7 +8,7 @@ <%= render Page::HeadingShowComponent.new(resource: @server, title: title, breadcrumb_steps:) do |heading| %> <% heading.with_extra_buttons do %> - <% render ButtonComponent.new(title: t("action.duplicate"), + <% render ButtonComponent.new(t("action.duplicate"), url: duplicate_server_path(@server.slug), variant: :success, icon: "copy", diff --git a/app/views/servers_grids/index.html.erb b/app/views/servers_grids/index.html.erb index af59ff7c3..1e76206ce 100644 --- a/app/views/servers_grids/index.html.erb +++ b/app/views/servers_grids/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: "Exporter au format CSV", + <% render ButtonComponent.new("Exporter au format CSV", url: url_for(format: :csv, params: @merged_params || {}), variant: :outline_primary, icon: "filetype-csv", diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb index cc9c08a9c..a41c57f53 100644 --- a/app/views/sites/index.html.erb +++ b/app/views/sites/index.html.erb @@ -5,7 +5,7 @@ <%= render Page::HeadingComponent.new(title: t(".title"), breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_site"), + <% render ButtonComponent.new(t(".new_site"), url: new_site_path, variant: :success, icon: "plus-lg", diff --git a/app/views/stacks/index.html.erb b/app/views/stacks/index.html.erb index 09b894563..5394fd93d 100644 --- a/app/views/stacks/index.html.erb +++ b/app/views/stacks/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_stack"), + <% render ButtonComponent.new(t(".new_stack"), url: new_stack_path, variant: :success, icon: "plus-lg", diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index c7a38d811..53dcfbca3 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -7,7 +7,7 @@ <%= render Page::HeadingComponent.new(title:, breadcrumb_steps:) do |heading| %> <% heading.with_right_content do %> - <% render ButtonComponent.new(title: t(".new_user"), + <% render ButtonComponent.new(t(".new_user"), url: new_user_path, variant: :success, icon: "plus-lg", diff --git a/app/views/visualization/bays/show.html.erb b/app/views/visualization/bays/show.html.erb index c9653d72e..f420fe05d 100644 --- a/app/views/visualization/bays/show.html.erb +++ b/app/views/visualization/bays/show.html.erb @@ -28,7 +28,7 @@ <% heading.with_right_content do %>
<%= render "rooms/action_buttons", view_side: params[:view] %> - <%= render(ButtonComponent.new(title: t("action.show"), + <%= render(ButtonComponent.new(t("action.show"), url: @bay, size: :sm, variant: :primary, diff --git a/app/views/visualization/frames/show.html.erb b/app/views/visualization/frames/show.html.erb index 8cf88e739..8e7362ba0 100644 --- a/app/views/visualization/frames/show.html.erb +++ b/app/views/visualization/frames/show.html.erb @@ -21,7 +21,7 @@ <% heading.with_right_content do %>
<%= render "rooms/action_buttons", view_side: Frame::VIEW_SIDES[:both] %> - <%= render(ButtonComponent.new(title: t("action.show"), + <%= render(ButtonComponent.new(t("action.show"), url: @frame, size: :sm, variant: :primary, diff --git a/spec/components/button_component_spec.rb b/spec/components/button_component_spec.rb index fbec19ddc..3e92e5467 100644 --- a/spec/components/button_component_spec.rb +++ b/spec/components/button_component_spec.rb @@ -5,7 +5,7 @@ RSpec.describe ButtonComponent, type: :component do let(:title) { "Title" } let(:url) { "/url" } - let(:component) { described_class.new(title:, url:) } + let(:component) { described_class.new(title, url:) } let(:rendered_component) { render_inline(component).to_html } context "with title and url" do @@ -19,13 +19,13 @@ describe "testing variant parameter" do context "with existing variant" do - let(:component) { described_class.new(title:, url:, variant: :primary) } + let(:component) { described_class.new(title, url:, variant: :primary) } it { expect(rendered_component).to have_tag("a.btn-default.btn-primary", href: "/url", title: "Title") } end context "with non-existing variant" do - let(:component) { described_class.new(title:, url:, variant: :unknown) } + let(:component) { described_class.new(title, url:, variant: :unknown) } it { expect { component }.to raise_error(ArgumentError) } end @@ -33,20 +33,20 @@ describe "testing size parameter" do context "with existing size" do - let(:component) { described_class.new(title:, url:, size: :sm) } + let(:component) { described_class.new(title, url:, size: :sm) } it { expect(rendered_component).to have_tag("a.btn-default.btn-sm", href: "/url", title: "Title") } end context "with non-existing size" do - let(:component) { described_class.new(title:, url:, size: :unknown) } + let(:component) { described_class.new(title, url:, size: :unknown) } it { expect { component }.to raise_error(ArgumentError) } end end context "with an icon" do - let(:component) { described_class.new(title:, url:, icon: "eye") } + let(:component) { described_class.new(title, url:, icon: "eye") } it do expect(rendered_component).to have_tag("a.btn-default.btn-default", href: "/url", title: "Title") do @@ -56,7 +56,7 @@ end context "with is_responsive set to true" do - let(:component) { described_class.new(title:, url:, is_responsive: true) } + let(:component) { described_class.new(title, url:, is_responsive: true) } it do expect(rendered_component).to have_tag("a.btn-default.btn-default", href: "/url", title: "Title") do @@ -66,7 +66,7 @@ end context "with extra_classes" do - let(:component) { described_class.new(title:, url:, extra_classes: "extra_class") } + let(:component) { described_class.new(title, url:, extra_classes: "extra_class") } it do expect(rendered_component).to have_tag("a.btn-default.btn-default.extra_class", href: "/url", title: "Title") @@ -74,7 +74,7 @@ end context "with html_options" do - let(:component) { described_class.new(title:, url:, method: :delete) } + let(:component) { described_class.new(title, url:, method: :delete) } it do expect(rendered_component).to have_tag("a.btn-default.btn-default[data-method='delete']", href: "/url")