Sha256: dfa286431357f5bd7c6c216727646934223e7e2a99c4d674334e06bdd31dae67

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

require "spec_helper"
require "chanko/test"

module Chanko
  describe Test do
    def rails5_action_view_instance
      Class.new(ActionView::Base).new
    end

    def rails6_action_view_instance
      klass = Class.new(ActionView::Base.with_empty_template_cache)
      klass.with_view_paths(nil, {}, nil)
    end

    let(:view) do
      case Rails::VERSION::MAJOR
      when 5
        rails5_action_view_instance
      when 6
        rails6_action_view_instance
      end
    end

    describe "#enable_unit" do
      it "forces to enable specified unit" do
        enable_unit(:inactive_unit)
        expect(view.invoke(:inactive_unit, :inactive, :type => :plain)).to eq("inactive")
      end
    end

    describe "#disable_unit" do
      it "forces to disable specified unit" do
        disable_unit(:example_unit)
        expect(view.invoke(:example_unit, :test)).to eq(nil)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chanko-2.3.0 spec/chanko/test_spec.rb