Method: RSpec::Rails::Matchers#be_a_new

Defined in:
lib/rspec/rails/matchers/be_a_new.rb

#be_a_new(model_class) ⇒ Object

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

Use the with method to specify the specific attributes to match on the new record.

Examples:

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)


78
79
80
# File 'lib/rspec/rails/matchers/be_a_new.rb', line 78

def be_a_new(model_class)
  BeANew.new(model_class)
end