test/skip_test.rb in representable-3.0.3 vs test/skip_test.rb in representable-3.0.4
- old
+ new
@@ -12,11 +12,11 @@
skip_parse: lambda { |options| options[:user_options][:skip?] and options[:fragment]["station"].nil? }, class: OpenStruct do
property :station
end
end
- let (:song) { OpenStruct.new.extend(representer) }
+ let(:song) { OpenStruct.new.extend(representer) }
# do parse.
it do
song.from_hash({
"title" => "Victim Of Fate",
@@ -28,21 +28,21 @@
song.band.name.must_equal "Mute 98"
song.airplays[0].station.must_equal "JJJ"
end
# skip parsing.
- let (:airplay) { OpenStruct.new(station: "JJJ") }
+ let(:airplay) { OpenStruct.new(station: "JJJ") }
it do
song.from_hash({
"title" => "skip me",
"band" => {},
"airplays" => [{}, {"station" => "JJJ"}, {}],
}, user_options: { skip?: true })
- song.title.must_equal nil
- song.band.must_equal nil
+ song.title.must_be_nil
+ song.band.must_be_nil
song.airplays.must_equal [airplay]
end
end
class SkipRenderTest < MiniTest::Spec
@@ -57,11 +57,11 @@
skip_render: lambda { |options| options[:user_options][:skip?] and options[:input].station == "Radio Dreyeckland" } do
property :station
end
end
- let (:song) { OpenStruct.new(title: "Black Night", band: OpenStruct.new(name: "Time Again")).extend(representer) }
- let (:skip_song) { OpenStruct.new(title: "Time Bomb", band: OpenStruct.new(name: "Rancid")).extend(representer) }
+ let(:song) { OpenStruct.new(title: "Black Night", band: OpenStruct.new(name: "Time Again")).extend(representer) }
+ let(:skip_song) { OpenStruct.new(title: "Time Bomb", band: OpenStruct.new(name: "Rancid")).extend(representer) }
# do render.
it { song.to_hash(user_options: { skip?: true }).must_equal({"title"=>"Black Night", "band"=>{"name"=>"Time Again"}}) }
# skip.
it { skip_song.to_hash(user_options: { skip?: true }).must_equal({"title"=>"Time Bomb"}) }
\ No newline at end of file