With rails 4, I have this test for one controller:
class Merchant::RegistrationsControllerTest < ActionController::TestCase test "should create new registration" do user = FactoryGirl.build(:merchant_user) #rest of the test using user as input for the controler end test "should not create new registration" do user = FactoryGirl.build(:merchant_user) #rest of the test using user as input for the controler endend And this other test for other controller: class FrontStore::RegistrationsControllerTest < ActionController::TestCase test "should create new registration" do user = FactoryGirl.build(:front_store_user) #rest of the test using user as input for the controler end test "should not create new registration" do user = FactoryGirl.build(:front_store_user) #rest of the test using user as input for the controler endend As you can see, Is violation of the DRY principle, because my tests are the same, but using a different fixture. As a note, both controllers inherits from the ApplicationRegistrationsController, that implements all the behaviour to both Merchant::RegistrationsController and FrontStore::RegistrationsController. I want to run both test for each of the role (Merchant or FrontStore) but not repeating the test code. My question is, how best design the test so they are reusable in this case? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/079cd09f-59a9-4fa7-98bb-71d6069d33c7%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.