Sha256: e934fbf7b18ad0693735dec0f9a017d1f7745cfae09597c9431a8b69a877dc1e

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

require "spec_helper"

module Nyanko
  describe UnitProxyProvider do
    let(:view) do
      Class.new { include Nyanko::UnitProxyProvider }.new
    end

    describe "#unit" do
      it "is aliased with `ext`" do
        view.ext(:example_unit).should be_a UnitProxy
      end

      context "when given unit name" do
        it "returns proxy for specified unit" do
          proxy = view.unit(:example_unit)
          proxy.should be_a UnitProxy
          proxy.unit.should == ExampleUnit
        end
      end

      context "when given no unit name" do
        before do
          Function.units << Loader.load(:example_unit)
        end

        after do
          Function.units.pop
        end

        it "returns proxy for the top unit of current unit stack" do
          proxy = view.unit
          proxy.unit.should == ExampleUnit
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nyanko-0.0.5 spec/nyanko/unit_proxy_provider_spec.rb
nyanko-0.0.4 spec/nyanko/unit_proxy_provider_spec.rb