Rails - Rspec: Is it possible to exclude / remove a test case in a shared_example? -


hello everyone.

i have been working on project , use shared example group manage rspec test.

for instance, have 2 actions in controller.

class userscontroller < applicationcontroller      def show       #...    end     def inspect        #...    end end 

and shared_example:

shared_examples "test"     #...some examples    "raise exception"      # ...    end end 

however, when call "inspect", not raise exception , result in test failure. possible disable or remove test case temporary when try test "inspect" action? (in real case, shared examples have been used many different tests , 1 has different behavior.)

thanks million.

you should able mark them broken , i.e exclude example based on flag. see more info here.

rspec.configure |c|   # declare exclusion filter   c.filter_run_excluding :broken => true end 

try declare configuration in seperate context test inspect configuration not affect others examples use shared example have.

for example:

 "raise exception", :broken => true      # spec not run   end 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -