Sha256: c6889093b24af9b69b9843bd047d6b6b67cb147fbd8b4d3ab6a798724219589c

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

Model specs live in spec/models, e.g. spec/models/account_spec.rb. A model spec
is a thin wrapper for an ActiveSupport::TestCase, and includes all of the
behavior and assertions that it provides, in addition to RSpec's own behavior
and expectations.

## Examples

    require "spec_helper"
    
    describe Post do
      context "with 2 or more comments" do
        it "orders them in reverse" do
          post = Post.create
          comment1 = post.comment("first")
          comment2 = post.comment("second")
          post.reload.comments.should eq([comment2, comment1])
        end
      end
    end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-rails-2.4.0 features/model_specs/README.md