Skip to content

Commit

Permalink
Fix warning about already defined constant in resource table specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Sep 3, 2024
1 parent 9d63ec7 commit bfa7a61
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions spec/components/alchemy/admin/resource/action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

require "rails_helper"

CustomResource = Struct.new(:name, :description)

RSpec.describe Alchemy::Admin::Resource::Action, type: :component do
let(:name) { nil }
let(:tooltip) { nil }
let(:block) { lambda { |item| "Foo" } }
let(:resource) { CustomResource.new("Foo", "Bar") }
let(:custom_resource) { Struct.new(:name, :description) }
let(:resource) { custom_resource.new("Foo", "Bar") }
let(:component) { described_class.new(name, tooltip, &block) }

subject(:render) do
Expand Down
5 changes: 2 additions & 3 deletions spec/components/alchemy/admin/resource/cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

require "rails_helper"

CustomResource = Struct.new(:name, :description)

RSpec.describe Alchemy::Admin::Resource::Cell, type: :component do
let(:css_classes) { "foo bar" }
let(:block) { lambda { |item| "Foo" } }
let(:resource) { CustomResource.new("Foo", "Bar") }
let(:custom_resource) { Struct.new(:name, :description) }
let(:resource) { custom_resource.new("Foo", "Bar") }
let(:component) { described_class.new(css_classes, &block) }

subject(:render) do
Expand Down
8 changes: 4 additions & 4 deletions spec/components/alchemy/admin/resource/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

require "rails_helper"

CustomResource = Struct.new(:name, :description)

RSpec.describe Alchemy::Admin::Resource::Table, type: :component do
let(:collection) { [] }
let(:component) { described_class.new(collection) }
Expand All @@ -15,10 +13,12 @@
end

context "with data" do
let(:custom_resource) { Struct.new(:name, :description) }

let(:collection) {
[
CustomResource.new("Foo", "Awesome description"),
CustomResource.new("Bar", "Another description")
custom_resource.new("Foo", "Awesome description"),
custom_resource.new("Bar", "Another description")
]
}

Expand Down

0 comments on commit bfa7a61

Please sign in to comment.