diff --git a/test/concept_test.rb b/test/concept_test.rb index 3eb6ebcd..884d4e6b 100644 --- a/test/concept_test.rb +++ b/test/concept_test.rb @@ -67,11 +67,24 @@ class ConceptTest < Minitest::Spec describe "#cell (in state)" do it { assert_instance_of Record::Cell, Cell::Concept.cell("record/cell", nil, context: { controller: Object }).cell("record/cell", nil) } - it { assert_equal "A Tribute To Rancid, with 24 songs! [{:controller=>Object}]", Cell::Concept.cell("record/cell", nil, context: { controller: Object }).concept("record/cell", nil, tracks: 24).(:description) } + it do + result = Cell::Concept.cell("record/cell", nil, context: { controller: Object }).concept("record/cell", nil, tracks: 24).(:description) + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4.0') + assert_equal "A Tribute To Rancid, with 24 songs! [{:controller=>Object}]", result + else + assert_equal "A Tribute To Rancid, with 24 songs! [{controller: Object}]", result + end + end it do - assert_equal "A Tribute To Rancid, with 24 songs! [{:controller=>Object}]A Tribute To Rancid, with 24 songs! [{:controller=>Object}]", - Cell::Concept.cell("record/cell", nil, context: { controller: Object }).concept("record/cell", collection: [1,2], tracks: 24).(:description) + result = Cell::Concept.cell("record/cell", nil, context: { controller: Object }).concept("record/cell", collection: [1,2], tracks: 24).(:description) + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4.0') + assert_equal "A Tribute To Rancid, with 24 songs! [{:controller=>Object}]A Tribute To Rancid, with 24 songs! [{:controller=>Object}]", result + else + assert_equal "A Tribute To Rancid, with 24 songs! [{controller: Object}]A Tribute To Rancid, with 24 songs! [{controller: Object}]", result + end end end end diff --git a/test/layout_test.rb b/test/layout_test.rb index 4a9efafb..9d1bd080 100644 --- a/test/layout_test.rb +++ b/test/layout_test.rb @@ -72,7 +72,12 @@ class LayoutCell < Cell::ViewModel class ExternalLayoutTest < Minitest::Spec it do result = Comment::ShowCell.new(nil, layout: Comment::LayoutCell, context: { beer: true }).() - assert_equal "$layout.erb{$show.erb, {:beer=>true}\n$show.erb, {:beer=>true}\n, {:beer=>true}}\n", result + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4.0') + assert_equal "$layout.erb{$show.erb, {:beer=>true}\n$show.erb, {:beer=>true}\n, {:beer=>true}}\n", result + else + assert_equal "$layout.erb{$show.erb, {beer: true}\n$show.erb, {beer: true}\n, {beer: true}}\n", result + end end # collection :layout diff --git a/test/public_test.rb b/test/public_test.rb index 0ff2326c..d7e7c0e9 100644 --- a/test/public_test.rb +++ b/test/public_test.rb @@ -45,7 +45,15 @@ class Songs < Cell::Concept end # ViewModel.cell(collection: []) passes generic options to cell. - it { assert_equal "[Object, {:genre=>\"Metal\", :context=>{:ready=>true}}][Module, {:genre=>\"Metal\", :context=>{:ready=>true}}]", Cell::ViewModel.cell("public_test/song", collection: [Object, Module], genre: 'Metal', context: { ready: true }).to_s } + it do + result = Cell::ViewModel.cell("public_test/song", collection: [Object, Module], genre: 'Metal', context: { ready: true }).to_s + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4.0') + assert_equal "[Object, {:genre=>\"Metal\", :context=>{:ready=>true}}][Module, {:genre=>\"Metal\", :context=>{:ready=>true}}]", result + else + assert_equal "[Object, {genre: \"Metal\", context: {ready: true}}][Module, {genre: \"Metal\", context: {ready: true}}]", result + end + end # ViewModel.cell(collection: [], method: :detail) invokes #detail instead of #show. # TODO: remove in 5.0. @@ -65,7 +73,12 @@ class Songs < Cell::Concept it do options = { genre: "Fusion", collection: [Object] } Cell::ViewModel.cell("public_test/song", options).() - assert_equal "{:genre=>\"Fusion\", :collection=>[Object]}", options.to_s + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4.0') + assert_equal "{:genre=>\"Fusion\", :collection=>[Object]}", options.to_s + else + assert_equal "{genre: \"Fusion\", collection: [Object]}", options.to_s + end end # cell(collection: []).join captures return value and joins it for you.