How to Test a Concern in Rails

后端 未结 4 1073
[愿得一人]
[愿得一人] 2020-12-07 10:36

Given that I have a Personable concern in my Rails 4 application which has a full_name method, how would I go about testing this using RSpec?

4条回答
  •  醉酒成梦
    2020-12-07 11:14

    Another thought is to use the with_model gem to test things like this. I was looking to test a concern myself and had seen the pg_search gem doing this. It seems a lot better than testing on individual models, since those might change, and it's nice to define the things you're going to need in your spec.

提交回复
热议问题