Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Misc. cleanup

  • Loading branch information...
commit 3b797c00517e1137c37ccaa17420c191a3321e7e 1 parent 40e5985
@practicingruby authored
View
8 secret_messages/lib/seekrit/dictionary.rb
@@ -1,12 +1,8 @@
require "shellwords"
module Seekrit
- class << (Dictionary = Object.new)
- def inspect
- "Seekrit::Dictionary"
- end
-
- def include?(word)
+ module Dictionary
+ def self.include?(word)
word = word.downcase
results = `grep ^#{Shellwords.shellescape(word)}$ /usr/share/dict/words`
View
4 secret_messages/lib/seekrit/letter_shifter.rb
@@ -1,8 +1,8 @@
module Seekrit
- class << (LetterShifter = Object.new)
+ module LetterShifter
ALPHABET = ("A".."Z").to_a
- def shift(letter, &offset)
+ def self.shift(letter, &offset)
return letter unless ALPHABET.include?(letter)
letter_position = (letter.ord - "A".ord)
View
2  secret_messages/test/acceptance_test.rb
@@ -1,4 +1,4 @@
-require "minitest/autorun"
+require_relative "helper"
CURRENT_DIR = File.expand_path(File.dirname(__FILE__))
View
2  secret_messages/test/caeser_cipher_test.rb
@@ -1,4 +1,4 @@
-require "minitest/autorun"
+require_relative "helper"
require_relative "../lib/seekrit/caeser_cipher"
describe Seekrit::CaeserCipher do
View
2  secret_messages/test/cracker_test.rb
@@ -1,5 +1,5 @@
+require_relative "helper"
require_relative "../lib/seekrit/cracker"
-require "minitest/autorun"
describe Seekrit::Cracker do
it "must be able to decode the key" do
View
2  secret_messages/test/dictionary_test.rb
@@ -1,4 +1,4 @@
-require "minitest/autorun"
+require_relative "helper"
require_relative "../lib/seekrit/dictionary"
describe Seekrit::Dictionary do
View
1  secret_messages/test/helper.rb
@@ -0,0 +1 @@
+require "minitest/autorun"
View
2  secret_messages/test/letter_shifter_test.rb
@@ -1,4 +1,4 @@
-require "minitest/autorun"
+require_relative "helper"
require_relative "../lib/seekrit/letter_shifter"
describe Seekrit::LetterShifter do
View
6 secret_messages/test/suite.rb
@@ -1,4 +1,8 @@
-require "minitest/autorun"
+require "simplecov"
+
+SimpleCov.start
+
+require_relative "helper"
require_relative "caeser_cipher_test"
require_relative "vigenere_cipher_test"
View
2  secret_messages/test/vigenere_cipher_test.rb
@@ -1,4 +1,4 @@
-require "minitest/autorun"
+require_relative "helper"
require_relative "../lib/seekrit/vigenere_cipher"
describe Seekrit::VigenereCipher do
Please sign in to comment.
Something went wrong with that request. Please try again.