Sha256: 9231dbe74a5f602d934a6296ae43bba08bfef9a2f7cb565fb11b374497ba2ab6
Contents?: true
Size: 881 Bytes
Versions: 2
Compression:
Stored size: 881 Bytes
Contents
require 'spec_helper' describe ActiveForm::ValidateUniqueness do class Form include ActiveForm::Form include ActiveForm::ValidateUniqueness properties :name, on: :user validates_uniqueness_of :name, :user end context "when there is no user" do it "is valid" do user = User.new form = Form.new(user: user) expect(form).to be_valid end end context "when there is user with the same email" do context "when the user is saved" do it "is valid" do user = User.create(name: 'name') form = Form.new(user: user) expect(form).to be_valid end end context "when the user is not saved" do it "is not valid" do User.create(name: 'name') user = User.new(name: 'name') form = Form.new(user: user) expect(form).to_not be_valid end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activeform-rails-0.0.2 | spec/activeform-rails/validate_uniqueness_spec.rb |
activeform-rails-0.0.1 | spec/activeform/validate_uniqueness_spec.rb |