1
I’m starting rspec tests on Rubyonrails and I’m having a problem testing my controller’s create:
it "creates lançamento" do
post :create, params: attributes_for(:lancamento), format: :js, xhr: true
expect(Lancamento.count).to eq(1)
end
I already created Factory with Factorygirl. The error is as follows:
1) LancamentosController testa cadastro lançamento creates lançamento
Failure/Error: params.require(:lancamento).permit(Lancamento.fields)
ActionController::ParameterMissing:
param is missing or the value is empty: lancamento
Any help is welcome, thank you!
Solved! thanks, only now it stops at no expect returning 0.
– Rafael Campos de Bastiani
Debug your controller, because it might fall into save Else for some validation.
– Gustavo Cunha
Exactly, validation, I’ll arrange the launch Factory. Thank you!
– Rafael Campos de Bastiani