Sha256: 8448efe319e9de44ca54770251db02ae833a1b2264121976ac0b3a9018c9945c

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

Feature: errors_on

  Scenario: with one validation error
    Given a file named "spec/models/widget_spec.rb" with:
      """
      require "spec_helper"

      class ValidatingWidget < ActiveRecord::Base
        set_table_name :widgets
        validates_presence_of :name
      end

      describe ValidatingWidget do
        it "fails validation with no name (using error_on)" do
          ValidatingWidget.new.should have(1).error_on(:name)
        end

        it "fails validation with no name (using errors_on)" do
          ValidatingWidget.new.should have(1).errors_on(:name)
        end

        it "passes validation with a name (using 0)" do
          ValidatingWidget.new(:name => "liquid nitrogen").should have(0).errors_on(:name)
        end

        it "passes validation with a name (using :no)" do
          ValidatingWidget.new(:name => "liquid nitrogen").should have(:no).errors_on(:name)
        end
      end
      """
    When I run "rspec spec/models/widget_spec.rb"
    Then I should see "4 examples, 0 failures"

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.16 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.15 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.14.2 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.14.1 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.13 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.12 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.11 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.10 features/model_specs/errors_on.feature
rspec-rails-2.0.0.beta.9.1 features/model_specs/errors_on.feature