#!/usr/bin/ruby

$:.unshift File.join(File.dirname(__FILE__), '..')

load 'daniel'

describe Daniel::PasswordGenerator do
	it "gives the expected password for foo, bar" do
		gen = Daniel::PasswordGenerator.new "foo"
		gen.generate("baz", Daniel::Parameters.new).should == "Dp4iWIX26UwV55N("
	end
	it "gives the expected reminder for foo, bar" do
		gen = Daniel::PasswordGenerator.new "foo"
		gen.reminder("baz", Daniel::Parameters.new).should == "8244c50a1000baz"
	end
	it "gives the expected password for foo, bar reminder" do
		gen = Daniel::PasswordGenerator.new "foo"
		gen.generate_from_reminder("8244c50a1000baz").should ==
      "Dp4iWIX26UwV55N("
	end
end

#!/usr/bin/ruby

$:.unshift File.join(File.dirname(__FILE__), '..')

load 'daniel'

describe Daniel::PasswordGenerator do
  [
    ["foo", "baz", "Dp4iWIX26UwV55N(", "8244c50a1000baz"],
  ].each do |items|
    master, code, result, reminder = items
    it "gives the expected password for #{master}, #{code}" do
      gen = Daniel::PasswordGenerator.new master
      gen.generate(code, Daniel::Parameters.new).should == result
    end
    it "gives the expected reminder for #{master}, #{code}" do
      gen = Daniel::PasswordGenerator.new master
      gen.reminder(code, Daniel::Parameters.new).should == reminder
    end
    it "gives the expected password for #{master}, #{code} reminder" do
      gen = Daniel::PasswordGenerator.new master
      gen.generate_from_reminder(reminder).should == result
    end
  end
end

Refactor tests to make multiple tests easier.
Refactor tests to make multiple tests easier.

Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
