Sha256: ddaa2c5d0d480f1e54fd1fdd568642d1eb74640164425100a8517180e7a567aa

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe Klasses do
    it { should be_a_kind_of Array }

    context "Klass" do
      context "#class_name" do
        it "gets class name without module" do
          klass = Klass.new("BlogPost", "Post", [])
          expect(klass.class_name).to eq("BlogPost")
        end

        it "gets class name with moduel" do
          klass = Klass.new("BlogPost", "Post", ["Admin"])
          expect(klass.class_name).to eq("Admin::BlogPost")
        end
      end

      context "#extend_class_name" do
        it "gets extend class name without module" do
          klass = Klass.new("BlogPost", "Post", [])
          expect(klass.extend_class_name).to eq("Post")
        end

        it "gets extend class name with module" do
          klass = Klass.new("BlogPost", "Post", ["Admin"])
          expect(klass.extend_class_name).to eq("Admin::Post")
        end
      end

      it "gets to_s equal to class_name" do
        klass = Klass.new("BlogPost", "Post", ["Admin"])
        expect(klass.to_s).to eq(klass.class_name)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_best_practices-1.19.0 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.18.1 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.18.0 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.17.0 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.16.0 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.15.7 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.15.6 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.15.4 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.15.3 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.15.2 spec/rails_best_practices/core/klasses_spec.rb
rails_best_practices-1.15.1 spec/rails_best_practices/core/klasses_spec.rb