How would you test this method with rspec?
def schema
@schema ||= Schema.new(owner, schedules, hour_interval)
end
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If felt inclined to ask “and what did you try to test it”, but here’s my answer anyway: If you’re unit testing in rspec, and you define methods to be your units, I would suggest to test it like this:
Like this, you test the unit and all it does in isolation.
For explanation regarding the details, look at The RSpec Documentation and/or Best RSpec Practices