why reload removes the values that has been updated on before(:each)
is there any other approach for doing such things
thanks in advance i have written my rspec as below
let!(:book){FactoryGirl.create(:book)
let!(:book2){FactoryGirl.create(:book)
before(:each) do
book.update_column(name:"my new book")
book2.update_column(name:"my second book")
end
it "does updation of name" do
data = book.rename_book
expect(book.reload.name).to eq("some new name")
expect(book2.reload.name).to not_eq("some new name") // here it removes the book name and make it as nil, how to prevent this
end
//the book2.reload is removes the book name and update it as nil, as how to fix it as it should display the second book name, instead it displays nil for that book.
Aucun commentaire:
Enregistrer un commentaire