Best practice to share specs within a gem

10 views
Skip to first unread message

slowjack2k

unread,
Jun 24, 2014, 3:15:25 AM6/24/14
to rs...@googlegroups.com
Hi,

rails ships for instance with ActiveModel::Lint::Tests. I can include this module into my test case and I'm sure my implemantation
behaves like ActiveModel.

What is best practice to do such things with rspec(3)?

Do I have to use shared example groups and use the magic strings / shared example name around?

Ok, I can do some thing like this:

module SharedSpec
  NAME = 'shared spec'

  shared_examples SharedSpec::NAME do |params|

  end
end

But I can't ensure that NAME is uniq and validating params is also not so easy like when I include a module into a class.

Does another approach exists?


regards
dieter
Reply all
Reply to author
Forward
0 new messages