Sha256: f3d0b9f5b5f16eb50d353c9462e09b239a8475db2e7c83f0dc201d930e47ebd7

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'ronin/exploits/mixins/text'

require 'ronin/exploits/exploit'

describe Ronin::Exploits::Mixins::Text do
  module TestTextMixin
    class TestExploit < Ronin::Exploits::Exploit
      include Ronin::Exploits::Mixins::Text
    end
  end

  let(:exploit_class) { TestTextMixin::TestExploit }
  subject { exploit_class.new }

  it "must include Ronin::Support::Text::Random::Mixin" do
    expect(exploit_class).to include(Ronin::Support::Text::Random::Mixin)
  end

  describe "#junk" do
    let(:count) { 1024 }

    it "must return a String of 'A' characters for the given count" do
      expect(subject.junk(count)).to eq('A' * count)
    end

    context "when given a custom character" do
      let(:char) { 'B' }

      it "must return a String of the given characters for the given count" do
        expect(subject.junk(char,count)).to eq(char * count)
      end
    end

    context "when given a custom String" do
      let(:string) { 'AB' }

      it "must return a String of the given String repeated for the given count" do
        expect(subject.junk(string,count)).to eq(string * count)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ronin-exploits-1.0.0.beta2 spec/mixins/text_spec.rb
ronin-exploits-1.0.0.beta1 spec/mixins/text_spec.rb