Sha256: 41a5d80191dc99ec0802a8f722fb6d479c9a3e5213a7de431184d8baeeeb4302

Contents?: true

Size: 957 Bytes

Versions: 4

Compression:

Stored size: 957 Bytes

Contents

require 'ronin/formatting/text'

require 'spec_helper'

describe String do
  before(:all) do
    @string = "hello"
  end

  it "should provide String#format_chars" do
    @string.respond_to?('format_chars').should == true
  end

  it "String#format_chars should format each character in the String" do
    @string.format_chars { |c|
      "_#{c}"
    }.should == "_h_e_l_l_o"
  end

  it "should provide String#format_bytes" do
    @string.respond_to?('format_bytes').should == true
  end

  it "String#format_bytes should format each byte in the String" do
    @string.format_bytes { |b|
      sprintf("%%%x",b)
    }.should == "%68%65%6c%6c%6f"
  end

  it "should provide String#random_case" do
    @string.respond_to?('random_case').should == true
  end

  it "String#random_case should randomly capitalize each character" do
    new_string = @string.random_case

    new_string.should_not == @string
    new_string.downcase.should == @string
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ronin-0.1.4 spec/formatting/text_spec.rb
ronin-0.2.0 spec/formatting/text_spec.rb
ronin-0.2.2 spec/formatting/text_spec.rb
ronin-0.2.1 spec/formatting/text_spec.rb