Skip to content

Commit

Permalink
elia/menu-items-cleanup: [wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Sep 21, 2023
1 parent 4903d35 commit 3295e54
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion backend/spec/lib/spree/backend_configuration/menu_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
end

it 'matches a proc accepting the request object' do
described_class.new(match_path: ->(request) { request.fullpath.iclude? == '/bar/' })
request = double(ActionDispatch::Request, fullpath: '/foo/bar/baz')
subject = described_class.new(match_path: -> { _1.fullpath.include? '/bar/' })

expect(subject.match_path?(request)).to be true
end
Expand Down Expand Up @@ -63,4 +63,20 @@
it { is_expected.to eq("/admin/friendly_promotions") }
end
end

describe "deprecated behavior" do
describe "passing `sections` and `icon` sequentially" do
it "warns about the deprecation" do
expect(Spree::Deprecation).to receive(:warn).with(a_string_matching(/sections/))
expect(Spree::Deprecation).to receive(:warn).with(a_string_matching(/icon/))

described_class.new([:foo, :bar], 'icon')
end

it "raises ArgumentError when providing the wrong number of sequential arguments" do
expect { described_class.new([:foo, :bar], 'icon', 'baz') }.to raise_error(ArgumentError)
expect { described_class.new([:foo, :bar]) }.to raise_error(ArgumentError)
end
end
end
end

0 comments on commit 3295e54

Please sign in to comment.