Sha256: f8ad7f6cd3476f6bf9fb4b2f1cacbf9d5c21efaeedd20f7d3e31cfb583969bda

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

require "test_helper"
require "cell/partial"

class PartialTest < MiniTest::Spec
  class WithPartial < Cell::ViewModel
    self.view_paths = ['test/fixtures'] # doesn't exist.
    include ::Cell::Erb

    include Partial

    def show
      render partial: "../fixtures/partials/show.html"
    end

    def show_with_format
      render partial: "../fixtures/partials/show", formats: [:xml]
    end

    def show_without_partial
      render :show
    end
  end

  class WithPartialAndManyViewPaths < WithPartial
    self.view_paths << ['app/views']
  end

  it { WithPartial.new(nil).show.must_equal "I Am Wrong And I Am Right" }
  it { WithPartial.new(nil).show_with_format.must_equal "<xml>I Am Wrong And I Am Right</xml>" }
  it { WithPartial.new(nil).show_without_partial.must_equal "Adenosine Breakdown" }

  it { WithPartialAndManyViewPaths.new(nil).show.must_equal "I Am Wrong And I Am Right" }
  it { WithPartialAndManyViewPaths.new(nil).show_with_format.must_equal "<xml>I Am Wrong And I Am Right</xml>" }
  it { WithPartialAndManyViewPaths.new(nil).show_without_partial.must_equal "Adenosine Breakdown" }
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cells-4.1.7 test/partial_test.rb
cells-4.1.6 test/partial_test.rb
cells-4.1.5 test/partial_test.rb
cells-4.1.4 test/partial_test.rb
cells-4.1.3 test/partial_test.rb
cells-4.1.2 test/partial_test.rb
cells-4.1.1 test/partial_test.rb
cells-4.1.0 test/partial_test.rb
cells-4.1.0.rc1 test/partial_test.rb
cells-4.0.5 test/partial_test.rb
cells-4.0.4 test/partial_test.rb
cells-4.0.3 test/partial_test.rb