Commit 5d115fdf authored by Gabriel Mazetto's avatar Gabriel Mazetto

Merge branch '344279-range-openstruct-fix' into 'master'

Fix OpenStruct use in range_spec

See merge request gitlab-org/gitlab!74412
parents fc1aff05 6bc58b03
...@@ -2598,7 +2598,6 @@ Style/OpenStructUse: ...@@ -2598,7 +2598,6 @@ Style/OpenStructUse:
- 'spec/lib/gitlab/graphql/pagination/keyset/connection_spec.rb' - 'spec/lib/gitlab/graphql/pagination/keyset/connection_spec.rb'
- 'spec/lib/gitlab/legacy_github_import/project_creator_spec.rb' - 'spec/lib/gitlab/legacy_github_import/project_creator_spec.rb'
- 'spec/lib/gitlab/quick_actions/command_definition_spec.rb' - 'spec/lib/gitlab/quick_actions/command_definition_spec.rb'
- 'spec/lib/gitlab/relative_positioning/range_spec.rb'
- 'spec/models/design_management/design_action_spec.rb' - 'spec/models/design_management/design_action_spec.rb'
- 'spec/models/design_management/design_at_version_spec.rb' - 'spec/models/design_management/design_at_version_spec.rb'
- 'spec/models/user_spec.rb' - 'spec/models/user_spec.rb'
......
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::RelativePositioning::Range do RSpec.describe Gitlab::RelativePositioning::Range do
item_a = OpenStruct.new(relative_position: 100, object: :x, positioned?: true) position_struct = Struct.new(:relative_position, :object, :positioned?)
item_b = OpenStruct.new(relative_position: 200, object: :y, positioned?: true)
item_a = position_struct.new(100, :x, true)
item_b = position_struct.new(200, :y, true)
before do before do
allow(item_a).to receive(:lhs_neighbour) { nil } allow(item_a).to receive(:lhs_neighbour) { nil }
...@@ -90,12 +92,12 @@ RSpec.describe Gitlab::RelativePositioning::Range do ...@@ -90,12 +92,12 @@ RSpec.describe Gitlab::RelativePositioning::Range do
end end
describe '#cover?' do describe '#cover?' do
item_c = OpenStruct.new(relative_position: 150, object: :z, positioned?: true) item_c = position_struct.new(150, :z, true)
item_d = OpenStruct.new(relative_position: 050, object: :w, positioned?: true) item_d = position_struct.new(050, :w, true)
item_e = OpenStruct.new(relative_position: 250, object: :r, positioned?: true) item_e = position_struct.new(250, :r, true)
item_f = OpenStruct.new(positioned?: false) item_f = position_struct.new(positioned?: false)
item_ax = OpenStruct.new(relative_position: 100, object: :not_x, positioned?: true) item_ax = position_struct.new(100, :not_x, true)
item_bx = OpenStruct.new(relative_position: 200, object: :not_y, positioned?: true) item_bx = position_struct.new(200, :not_y, true)
where(:lhs, :rhs, :item, :expected_result) do where(:lhs, :rhs, :item, :expected_result) do
[ [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment