ruby on rails - Why will this test not run with sucker punch gem? -


The purpose of this code is to send an e-mail to a user of a product with a discount percentage of a given limit Has reached. The products give an array of 2 element arrays with the following formats:

  user.notifications  

  [ [Product, Notification]]  

A notification is made of a discount percentage and one product_id

  send_notification?  

Checks to see if a notification has been sent to the user within the last 7 days and the bullion has been returned (if they have not received an email last week and If the product is being passed, they are liars.)

I have the following work with and the exam is:

Category ProductNotificationEmailJob includes Scorpion :: Job Df (user) user_notifications = user.notifications || [] Products = [] Notifications = [] UserNotation.Each | Notification | If notification [1] .end_notification? Product & lt; & Lt; Notification [0] Notifications & lt; & Lt; Notification [1] End Notification Mailer. Notification_email (user, product). Deliver notifications. Extra | Notification | Notification.Date (Notification_date: Time.On) End And End

Exam:

  Requires' rails_helper 'ProductNotificationEmailJob' ObjectCreation .create_notification expected (Notification.Notification_Det). Be_nil user = notification.user stub = double ("object") is expected (notification mailer). To receive (: notification_email) .with (user, [notification.my_product.product]). And (seat) is expected (stub). To receive (: distributed) ProductNotificationEmailJob.new.perform (user) is expected (MyProductsNotification.last.notification_date) .to_not be_nil and end  

When I take out the line: Skinkpunch: : The job included in the exam is fine, but I can not get it to pass though that line. SoccerPunch :: For some reason with the job line it seems as if the way to create an object does not work and returns zero for all the values. If I have not given enough detail, then I apologize in advance, but I did not want to post too much code. Leave a comment and I will include any description of the request Thank you for your time, I really appreciate it!

After seeing the problem with fresh eyes, I realized that productNotificationEmailJob has to do all that stuff in the classroom. By trying, it was also violating the encapsulation rules. I got it in another class and everything is going well and is fully tested.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -