Sha256: 85c495c0880a855a22e5a141eff0aabcfb0fd2c9592f967927fdaf63b57fa4b3

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 Bytes

Contents

require File.join(File.dirname(__FILE__), 'spec_helper')

describe SolitaireCipher, "creation" do
  it "should allow us to create a new instance with a key stream as a string" do
    lambda {
      SolitaireCipher.new("KEYS TREA MONE")
    }.should_not raise_error
  end

  it "should require a key steam to be specified" do
    lambda {
      SolitaireCipher.new()
    }.should raise_error(ArgumentError)

    lambda {
      SolitaireCipher.new(nil)
    }.should raise_error(ArgumentError)
  end
end

describe SolitaireCipher do
  before(:each) do
    @key_stream = "DWJXH YRFDG TMSHP UURXJ"
    @solitaire_cipher = SolitaireCipher.new(@key_stream)
  end

  describe "encoding" do
    it "should encode the string 'Code in Ruby, live longer!' as 'GLNCQ MJAFF FVOMB JIYCB'" do
      @solitaire_cipher.encode("Code in Ruby, live longer!").should == "GLNCQ MJAFF FVOMB JIYCB"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mathie-solitaire_cipher-1.0.0 spec/solitaire_cipher_spec.rb