Sha256: f1485125ccb1eb7be4dc0e53b204f5d3a9ca8532b06a7f621d9ea97f0ecfe2e4

Contents?: true

Size: 822 Bytes

Versions: 5

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

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

    context "Modules" do
      before do
        @mod = Mod.new("PostsHelper", [])
      end
      subject { Modules.new.tap { |modules| modules << @mod } }
      it "should add descendant to the corresponding module" do
        expect(@mod).to receive(:add_descendant).with("PostsController")
        subject.add_module_descendant("PostsHelper", "PostsController")
      end
    end

    context "Mod" do
      subject {
        Mod.new("UsersHelper", ["Admin"]).tap do |mod|
          mod.add_descendant("Admin::UsersController")
        end
      }
      it { expect(subject.to_s).to eq("Admin::UsersHelper") }
      it { expect(subject.descendants).to eq(["Admin::UsersController"]) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_best_practices-1.19.0 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.18.1 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.18.0 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.17.0 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.16.0 spec/rails_best_practices/core/modules_spec.rb