The opposite of assert_select?

后端 未结 4 718
天涯浪人
天涯浪人 2021-02-01 13:06

I am writing an app where it is desirable to check if a view does not have some functionality - in particular because that functionality must be presented only to users

4条回答
  •  盖世英雄少女心
    2021-02-01 13:32

    I had this problem to ensure there WASN'T a 'Delete' button, out of many buttons. The accepted answer would not work in this situation because there are already several buttons.

    assert_select '.button' do |btn|
      btn.each do |b|
        assert_no_match 'Delete', b.to_s
      end
    end
    

    However, I really like GantMan's answer better!

提交回复
热议问题