Sha256: bb5273724d9da99386fcd6faff48e5679336ac774a178c22a71fa4d98665f9e6

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"

module Chanko
  module Unit
    describe ScopeFinder do
      describe ".find(identifier)" do
        context "when identifier is a class" do
          it "returns identifier with no change" do
            identifier = ActionView::Base
            described_class.find(identifier).should == ActionView::Base
          end
        end

        context "when identifier is a reserved label" do
          it "returns reserved class for that" do
            identifier = :view
            described_class.find(identifier).should == ActionView::Base
          end
        end

        context "when identifier is a string that means a class" do
          it "returns class of that string" do
            identifier = "ActionView::Base"
            described_class.find(identifier).should == ActionView::Base
          end
        end

        context "when no class is found" do
          it "returns nil" do
            identifier = "Non::Existent::Class"
            described_class.find(identifier).should == nil
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chanko-2.0.6 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.5 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.4 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.3 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.2 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.1 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.0 spec/chanko/unit/scope_finder_spec.rb