user3447780
user3447780

Reputation: 175

TypeError: can't convert Class into String

A test gaves me that error on this method,

def test_create
 get :new    
 assert_template 'admin/supplier/new'
 assert_difference(Supplier, :count) do
   post :create, :supplier => {:name => 'Juan', :province => 'provincia'}
   assert_response :redirect
   assert_redirected_to :action => 'index'      
 end
 assert_equal 'was succesfully created.', flash[:notice]
end

exactly the error is on

assert_difference(Supplier, :count) do

Upvotes: 1

Views: 195

Answers (1)

user2062950
user2062950

Reputation:

You aren't using assert_difference correctly. Try

assert_difference 'Supplier.count' do

More examples are in the docs

Upvotes: 3

Related Questions