I have following code snippet in my `CompaniesController`

```
class CompaniesController < ApplicationController
  def new
    @company  = Company.new
    @company.employees.build
  end

```

In my Rspec how can I check that `build` method is called inside `new` action?

I tried something like this

```
expect(assigns(:company).employees).to have_received(:build)

```

but I am getting following error message:

```
#<Employee::ActiveRecord_Associations_CollectionProxy:0x007fe2ca2141e8> expected to have received build, but that object is not a spy or method has not been stubbed.

```

Do I need to stub employee first?

Update:
=======

Rspec for new action

```
describe "GET 'new'" do

before { get :new }

it 'assigns @domain_name' do
  expect(assigns(:domain_name)).to eq(request.host)
end

it 'assigns @company' do
  expect(assigns(:company)).to be_a_new(Company)
end

it 'renders the new template' do
  expect(response).to render_template('new')
end

```

end

Thanks