Sha256: 57d9679ed1b9f4ac3462555a04a45aaa2c98aa69424350de3a01aba3c1de0164

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 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
            expect(described_class.find(identifier)).to eq(ActionView::Base)
          end
        end

        context "when identifier is a reserved label" do
          it "returns reserved class for that" do
            identifier = :view
            expect(described_class.find(identifier)).to eq(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"
            expect(described_class.find(identifier)).to eq(ActionView::Base)
          end
        end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chanko-2.3.0 spec/chanko/unit/scope_finder_spec.rb
chanko-2.2.1 spec/chanko/unit/scope_finder_spec.rb
chanko-2.2.0 spec/chanko/unit/scope_finder_spec.rb
chanko-2.1.1 spec/chanko/unit/scope_finder_spec.rb
chanko-2.1.0 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.8 spec/chanko/unit/scope_finder_spec.rb
chanko-2.0.7 spec/chanko/unit/scope_finder_spec.rb