Sha256: ace54550079977b0da86d533890ba7756d6ce5888a77ef2d9d0c431e1c68ca1f

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

require_relative "helper"

class Signup < Scrivener
  attr_accessor :password
  attr_accessor :password_confirmation

  def validate
    assert_confirmation :password
  end
end

test "invalid if confirmation and attribute are not equal" do
  signup = Signup.new(password: "!", password_confirmation: "?")

  assert !(signup.valid?)
  assert_equal [:not_confirmed], signup.errors[:password]
end

test "valid if confirmation and attribute are equal" do
  signup = Signup.new(password: "!", password_confirmation: "!")

  assert signup.valid?
  assert signup.errors.empty?
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrivener-contrib-1.1.0 test/confirmation.rb
scrivener-contrib-1.0.0 test/confirmation.rb