spec/password_salt_spec.rb in dionysus-0.3.0 vs spec/password_salt_spec.rb in dionysus-0.3.1

- old
+ new

@@ -91,10 +91,14 @@ 100.times do salt = PasswordSalt.generate(100, :binary) salt.should_not match(/\A[A-Za-z0-9\+\/]{100}\Z/) end end + + it "should raise an error with an invalid format" do + lambda { PasswordSalt.generate(10, :foobar) }.should raise_error(ArgumentError, "Invalid format: foobar") + end end describe "after placement" do before(:each) do @password = 'foobar' @@ -107,9 +111,15 @@ end it "should put the salt after the password" do salt = PasswordSalt.new(@salt, :after) salt.salt_password(@password).should == @password+@salt + end + + it "should raise an error with a bad placement" do + salt = PasswordSalt.new(@salt) + salt.instance_variable_set('@placement', :foobar) + lambda { salt.salt_password(@password) }.should raise_error(RuntimeError, "Invalid salt placement: foobar") end end describe "before placement" do before(:each) do \ No newline at end of file