require 'spec_helper'

module RoInsHelper
  include ::RoHelper::Meta

  module M
    def meth_in_m(*args, &blk)

    end
  end

end

module RoInsHelper

  module M2
    def meth_in_m2(*args, &blk)

    end
  end

end

module RoKlsMeths
  module Kls
    def meth_in_kls(*args, &blk)

    end
  end

end

module RoKlsMeths
  module Kls2
    def meth_in_kls2(*args, &blk)

    end
  end
end


module RoMod
  include ::RoHelper::Meta

  include_subs_of ::RoInsHelper
  extend_subs_of ::RoKlsMeths
  # meth_in_kls2
end

describe "RoInclude" do
  let(:o) do
    RoMod
  end

  it "have method meth_in_m" do
    expect(o).to have_meth :"meth_in_m"
  end

  it "have_method meth_in_m2" do
    expect(o).to have_meth :"meth_in_m2"
  end

  it "have_method meth_in_kls" do
    expect(o).to have_meth :"meth_in_kls"
  end

  it "have_method meth_in_kls2" do
    expect(o).to have_meth :"meth_in_kls2"
  end

  it :include_all_modules_in do
    RoFaker.flow do |f|
      cdfix "meta_helper"
      f.f "lib/path/to/mod.rb", <<-CONTENT

module Path
  module To
    module Mod

    end
  end
end
      CONTENT
      f.f "lib/path/to/mod/two.rb", <<-CONTENT

module Path
  module To
    module Mod
    	module Two
      end
    end
  end
end
      CONTENT
    end

    o.include_all_modules_in(File.join(Dir.pwd, "lib"))
  end

end
