Sha256: 19f52c278e53f2aeb28f4d5e033b348c9f64229628c541fbd5b23779200e84f1

Contents?: true

Size: 817 Bytes

Versions: 6

Compression:

Stored size: 817 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 decendant to the corresponding module" do
        expect(@mod).to receive(:add_decendant).with("PostsController")
        subject.add_module_decendant("PostsHelper", "PostsController")
      end
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_best_practices-1.15.7 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.15.6 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.15.4 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.15.3 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.15.2 spec/rails_best_practices/core/modules_spec.rb
rails_best_practices-1.15.1 spec/rails_best_practices/core/modules_spec.rb