spec/plugin/flash_spec.rb in roda-2.2.0 vs spec/plugin/flash_spec.rb in roda-2.3.0

- old
+ new

@@ -12,11 +12,11 @@ flash['a'] end end end - body.should == 'b' + body.must_equal 'b' end it "flash[] sets flash for next page" do app(:bare) do use Rack::Session::Cookie, :secret => "1" @@ -34,90 +34,91 @@ end end env = proc{|h| h['Set-Cookie'] ? {'HTTP_COOKIE'=>h['Set-Cookie'].sub("; path=/; HttpOnly", '')} : {}} _, h, b = req - b.join.should == '' + b.join.must_equal '' _, h, b = req(env[h]) - b.join.should == 'b' + b.join.must_equal 'b' _, h, b = req(env[h]) - b.join.should == 'bb' + b.join.must_equal 'bb' _, h, b = req('/a', env[h]) - b.join.should == 'cbbb' + b.join.must_equal 'cbbb' _, h, b = req(env[h]) - b.join.should == '' + b.join.must_equal '' _, h, b = req(env[h]) - b.join.should == 'b' + b.join.must_equal 'b' _, h, b = req(env[h]) - b.join.should == 'bb' + b.join.must_equal 'bb' end end describe "FlashHash" do before do + require 'roda/plugins/flash' @h = Roda::RodaPlugins::Flash::FlashHash.new end it ".new should accept nil for empty hash" do @h = Roda::RodaPlugins::Flash::FlashHash.new(nil) - @h.now.should == {} - @h.next.should == {} + @h.now.must_equal({}) + @h.next.must_equal({}) end it ".new should accept a hash" do @h = Roda::RodaPlugins::Flash::FlashHash.new(1=>2) - @h.now.should == {1=>2} - @h.next.should == {} + @h.now.must_equal(1=>2) + @h.next.must_equal({}) end it "#[]= assigns to next flash" do @h[1] = 2 - @h.now.should == {} - @h.next.should == {1=>2} + @h.now.must_equal({}) + @h.next.must_equal(1=>2) end it "#discard removes given key from next hash" do @h[1] = 2 @h[nil] = 3 - @h.next.should == {1=>2, nil=>3} + @h.next.must_equal(1=>2, nil=>3) @h.discard(nil) - @h.next.should == {1=>2} + @h.next.must_equal(1=>2) @h.discard(1) - @h.next.should == {} + @h.next.must_equal({}) end it "#discard removes all entries from next hash with no arguments" do @h[1] = 2 @h[nil] = 3 - @h.next.should == {1=>2, nil=>3} + @h.next.must_equal(1=>2, nil=>3) @h.discard - @h.next.should == {} + @h.next.must_equal({}) end it "#keep copies entry for key from current hash to next hash" do @h.now[1] = 2 @h.now[nil] = 3 - @h.next.should == {} + @h.next.must_equal({}) @h.keep(nil) - @h.next.should == {nil=>3} + @h.next.must_equal(nil=>3) @h.keep(1) - @h.next.should == {1=>2, nil=>3} + @h.next.must_equal(1=>2, nil=>3) end it "#keep copies all entries from current hash to next hash" do @h.now[1] = 2 @h.now[nil] = 3 - @h.next.should == {} + @h.next.must_equal({}) @h.keep - @h.next.should == {1=>2, nil=>3} + @h.next.must_equal(1=>2, nil=>3) end it "#sweep replaces current hash with next hash" do @h[1] = 2 @h[nil] = 3 - @h.next.should == {1=>2, nil=>3} - @h.now.should == {} - @h.sweep.should == {1=>2, nil=>3} - @h.next.should == {} - @h.now.should == {1=>2, nil=>3} + @h.next.must_equal(1=>2, nil=>3) + @h.now.must_equal({}) + @h.sweep.must_equal(1=>2, nil=>3) + @h.next.must_equal({}) + @h.now.must_equal(1=>2, nil=>3) end end