Sha256: c2a22c00811bb88e4afe719d0b081505cab8da1a00811cb58ed6c91844f785ed

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

class RailsViewTest < MiniTest::Spec
  include Cell::TestCase::TestMethods
  
  describe "A cell view" do
    # DISCUSS: it we allow :partial from a state, too?
    describe "calling render :partial" do
      it "render the local cell partial in bassist/dii" do
        assert_equal("Dii", in_view(:bassist) do
          render :partial => 'dii'
        end)
      end
      
      it "render the foreign cell partial in bad_guitarist/dii" do
        assert_equal("Dooom", in_view(:bassist) do
          render :partial => "bad_guitarist/dii"
        end)
      end


      it "render the global partial app/views/shared/dong" do
        class PercussionistCell < BassistCell
          append_view_path("test/app/views")
        end
        assert_equal("Dong!", in_view("rails_view_test/percussionist") do
          render :partial => "shared/dong"
        end)
      end
    end
    
    it "respond to render :state" do
      assert_equal("Doo", in_view(:bassist) do
        render :state => :play
      end)
    end
    
    it "respond to render :state with options" do
      BassistCell.class_eval do
        def listen(*args)
          render :text => "Listening to #{args.join(' ')}"
        end
      end
      assert_equal("Listening to Much the Same", in_view(:bassist) do
        render({:state => :listen}, "Much", "the", "Same")
      end)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cells-3.9.0 test/rails/view_test.rb
cells-3.8.8 test/rails/view_test.rb
cells-3.8.7 test/rails/view_test.rb