Sha256: 55895f2c85dab203817f7045de2ae87323c0f7b225261813b6af90869ea05946

Contents?: true

Size: 1.67 KB

Versions: 7

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'
require 'ronin/installation'

describe Installation do
  it "should load the gemspec for the 'ronin' library" do
    subject.gems['ronin'].should_not be_nil
  end

  it "should provide the names of the installed Ronin libraries" do
    subject.libraries.should include('ronin')
  end

  describe "each_file" do
    let(:directory) { 'lib/ronin/ui/cli/commands' }
    let(:pattern) { File.join(directory,'*.rb') }
    let(:expected) {
      %w[
        campaigns.rb
        console.rb
        creds.rb
        database.rb
        emails.rb
        exec.rb
        help.rb
        hosts.rb
        ips.rb
        repos.rb
        urls.rb
      ].map { |name| File.join(directory,name) }
    }

    it "should enumerate over the files which match a glob pattern" do
      subject.each_file(pattern).to_a.should =~ expected
    end

    it "should return an Enumerator when no block is given" do
      subject.each_file(pattern).all? { |file|
        expected.include?(file)
      }.should == true
    end
  end

  describe "each_file_in" do
    let(:directory) { 'lib/ronin/ui/cli/commands' }
    let(:ext) { :rb }
    let(:expected) {
      %w[
        campaigns.rb
        console.rb
        creds.rb
        database.rb
        emails.rb
        exec.rb
        help.rb
        hosts.rb
        ips.rb
        repos.rb
        urls.rb
      ]
    }

    it "should enumerate over the files which match a glob pattern" do
      subject.each_file_in(directory,ext).to_a.should =~ expected
    end

    it "should return an Enumerator when no block is given" do
      subject.each_file_in(directory,ext).all? { |file|
        expected.include?(file)
      }.should == true
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ronin-1.3.0 spec/installation_spec.rb
ronin-1.2.0 spec/installation_spec.rb
ronin-1.1.0 spec/installation_spec.rb
ronin-1.1.0.rc3 spec/installation_spec.rb
ronin-1.1.0.rc2 spec/installation_spec.rb
ronin-1.1.0.rc1 spec/installation_spec.rb
ronin-1.0.0 spec/installation_spec.rb