Write model rspec for my application

I am a beginner in ruby and rails and struggling to write rspec code for my model methods as given below:

Please help me write rspec implementation and test examples for my methods for me to have a basic understanding of how can I proceed in this:

def get_quarantine_trails(event_id)
quarantine_event_result = quarantine_events.find_by(id: event_id)
quarantine_event_result.inventory_items.select([:item_number, :id])

def quarantine_events_list
select(‘quarantine_events.*,count(quarantine_trails.quarantine_event_id) as count_of_events’).

Here: quarantine_events and quarantine_trails are 2 models where they have direct association in between them. quarantine_events table being my parent table and quarantine_trails being my child table.
inventory_items is another model having association with quarantine_trail table.

Help me create a rspec implementation for this 2 methods for my initial understanding.

Thank you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs