Module: RSpec::Rails::Matchers

### Home Classes Methods

### In Files

- lib/rspec/rails/matchers.rb
- lib/rspec/rails/matchers/be_a_new.rb
- lib/rspec/rails/matchers/be_new_record.rb
- lib/rspec/rails/matchers/be_valid.rb
- lib/rspec/rails/matchers/have_extension.rb
- lib/rspec/rails/matchers/have_rendered.rb
- lib/rspec/rails/matchers/redirect_to.rb
- lib/rspec/rails/matchers/routing_matchers.rb

### Namespace

- MODULE RSpec::Rails::Matchers::HaveExtensions
- MODULE RSpec::Rails::Matchers::RedirectTo
- MODULE RSpec::Rails::Matchers::RenderTemplate
- MODULE RSpec::Rails::Matchers::RoutingMatchers
- CLASS RSpec::Rails::Matchers::BeANew
- CLASS RSpec::Rails::Matchers::BeANewRecord
- CLASS RSpec::Rails::Matchers::BeValid

### Methods

- #be_a_new
- #be_new_record
- #be_valid

### Files

- fixture

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Rails
- RSpec::Rails::AssertionDelegator
- RSpec::Rails::ControllerExampleGroup
- RSpec::Rails::ControllerExampleGroup::BypassRescue
- RSpec::Rails::ControllerExampleGroup::ClassMethods
- RSpec::Rails::Extensions
- RSpec::Rails::Extensions::ActiveRecord
- RSpec::Rails::FeatureExampleGroup
- RSpec::Rails::FixtureSupport
- RSpec::Rails::HelperExampleGroup
- RSpec::Rails::HelperExampleGroup::ClassMethods
- RSpec::Rails::IllegalDataAccessException
- RSpec::Rails::MailerExampleGroup
- RSpec::Rails::MailerExampleGroup::ClassMethods
- RSpec::Rails::Matchers
- RSpec::Rails::Matchers::BeANew
- RSpec::Rails::Matchers::BeANewRecord
- RSpec::Rails::Matchers::BeValid
- RSpec::Rails::Matchers::HaveExtensions
- RSpec::Rails::Matchers::RedirectTo
- RSpec::Rails::Matchers::RedirectTo::RedirectTo
- RSpec::Rails::Matchers::RenderTemplate
- RSpec::Rails::Matchers::RenderTemplate::RenderTemplateMatcher
- RSpec::Rails::Matchers::RoutingMatchers
- RSpec::Rails::Matchers::RoutingMatchers::BeRoutableMatcher
- RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers
- RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher
- RSpec::Rails::MiniTestLifecycleAdapter
- RSpec::Rails::MinitestCounters
- RSpec::Rails::Mocks
- RSpec::Rails::Mocks::ActiveModelInstanceMethods
- RSpec::Rails::Mocks::ActiveModelStubExtensions
- RSpec::Rails::Mocks::ActiveRecordInstanceMethods
- RSpec::Rails::Mocks::ActiveRecordStubExtensions
- RSpec::Rails::ModelExampleGroup
- RSpec::Rails::ModuleInclusion
- RSpec::Rails::RailsExampleGroup
- RSpec::Rails::Railtie
- RSpec::Rails::RequestExampleGroup
- RSpec::Rails::RoutingExampleGroup
- RSpec::Rails::RoutingExampleGroup::ClassMethods
- RSpec::Rails::SetupAndTeardownAdapter
- RSpec::Rails::SetupAndTeardownAdapter::ClassMethods
- RSpec::Rails::TestUnitAssertionAdapter
- RSpec::Rails::TestUnitAssertionAdapter::AssertionDelegator
- RSpec::Rails::TestUnitAssertionAdapter::ClassMethods
- RSpec::Rails::Version
- RSpec::Rails::ViewAssigns
- RSpec::Rails::ViewExampleGroup
- RSpec::Rails::ViewExampleGroup::ClassMethods
- RSpec::Rails::ViewExampleGroup::ExampleMethods
- RSpec::Rails::ViewRendering
- RSpec::Rails::ViewRendering::ClassMethods
- RSpec::Rails::ViewRendering::EmptyTemplateHandler
- RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator
- RSpec::Rails::ViewRendering::EmptyTemplates
- Rspec
- Rspec::Generators
- Rspec::Generators::Base
- Rspec::Generators::ControllerGenerator
- Rspec::Generators::HelperGenerator
- Rspec::Generators::InstallGenerator
- Rspec::Generators::IntegrationGenerator
- Rspec::Generators::MailerGenerator
- Rspec::Generators::ModelGenerator
- Rspec::Generators::ObserverGenerator
- Rspec::Generators::ScaffoldGenerator
- Rspec::Generators::ViewGenerator
- Rails
- Rails::Generators
- Rails::Generators::GeneratedAttribute
- Test
- Test::Unit
- Test::Unit::AssertionFailedError
- ActiveModel
- ActiveModel::Validations
- ActiveRecord
- ActiveRecord::Base
- Autotest
- Autotest::RailsRspec2
- Object
- RequestInstanceMethods

No matching classes.

# RSpec::Rails::Matchers

### Public Instance Methods

be_a_new(model_class) click to toggle source

Passes if actual is an instance of `model_class` and returns `false` for `persisted?`. Typically used to specify instance variables assigned to views by controller actions

@example

    get :new
    assigns(:thing).should be_a_new(Thing)

    post :create, :thing => { :name => "Illegal Value" }
    assigns(:thing).should be_a_new(Thing).with(:name => nil)

    # File lib/rspec/rails/matchers/be_a_new.rb, line 73
    def be_a_new(model_class)
      BeANew.new(model_class)
    end

be_new_record() click to toggle source

Passes if actual returns `false` for `persisted?`.

@example

    get :new
    assigns(:thing).should be_new_record

    # File lib/rspec/rails/matchers/be_new_record.rb, line 24
    def be_new_record
      BeANewRecord.new
    end

be_valid(*args) click to toggle source

Passes if the given model instance's `valid?` method is true, meaning all of the `ActiveModel::Validations` passed and no errors exist. If a message is not given, a default message is shown listing each error.

@example

    thing = Thing.new
    thing.should be_valid

    # File lib/rspec/rails/matchers/be_valid.rb, line 37
    def be_valid(*args)
      BeValid.new(*args)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.