Sha256: 32c31b90f1b0a620c733ce131994bdc5ccfea3dee5c5ba5b9199b1170969d77a

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

require 'spec_helper'

describe Vanguard::DSL, '#validates_confirmation_of' do
  include Spec::Shared::DSL

  let(:confirmation_attribute_name) { "#{attribute_name}_explicit_confirmation" }

  before do
    class_under_test.send(:attr_accessor, confirmation_attribute_name)
    builder.validates_confirmation_of(attribute_name, :confirm => confirmation_attribute_name)
    resource.send("#{confirmation_attribute_name}=", confirmation_value)
  end

  describe 'when confirmation value matches' do
    let(:attribute_value)    { :foo }
    let(:confirmation_value) { :foo }

    it_should_be_a_valid_instance
  end

  describe 'when confirmation value does not match' do
    let(:attribute_value) { :foo }
    let(:confirmation_value) { :bar }

    it_should_be_an_invalid_instance
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vanguard-0.0.5 spec/integration/vanguard/dsl/validates_confirmation_of_spec.rb
vanguard-0.0.4 spec/integration/vanguard/dsl/validates_confirmation_of_spec.rb
vanguard-0.0.3 spec/integration/vanguard/dsl/validates_confirmation_of_spec.rb