Sha256: f97539547bcbc01b4e6571eee01418c56654daf574496dd3f8e42ee3ed8e5b47

Contents?: true

Size: 821 Bytes

Versions: 13

Compression:

Stored size: 821 Bytes

Contents

require 'test_helper'

class RackTest < MiniTest::Spec
  class BassistCell < Cell::Rack
    def play
      render :text => request.class
    end
    
    def sing
      render :text => session[:what]
    end
  end
  
  describe "Cell::Rack" do
    before do
      @request = ActionDispatch::TestRequest.new
    end
    
    it "allows accessing the request object" do
      assert_equal "ActionDispatch::TestRequest", BassistCell.new(@request).render_state(:play)
    end
    
    it "allows accessing the session object" do
      @request.session[:what] = "Yo!"
      assert_equal "Yo!", BassistCell.new(@request).render_state(:sing)
    end
    
    it "works with #render_cell_for" do
      assert_equal "ActionDispatch::TestRequest", Cell::Rack.render_cell_for("rack_test/bassist", :play, @request)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cells-3.11.3 test/rack_test.rb
cells-3.11.2 test/rack_test.rb
cells-3.11.1 test/rack_test.rb
cells-3.11.0 test/rack_test.rb
cells-3.10.1 test/rack_test.rb
cells-3.10.0 test/rack_test.rb
cells-3.9.1 test/rack_test.rb
cells-3.9.0 test/rack_test.rb
cells-3.8.8 test/rack_test.rb
cells-3.8.7 test/rack_test.rb
cells-3.8.6 test/rack_test.rb
cells-3.8.5 test/rack_test.rb
cells-3.8.4 test/rack_test.rb