How to run a single RSpec test?

后端 未结 17 773

I have the following file:

/spec/controllers/groups_controller_spec.rb

What command in terminal do I use to run just that spec and in what

17条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 05:24

    starting with rspec 2 you can use the following:

    # in spec/spec_helper.rb
    RSpec.configure do |config|
      config.filter_run :focus => true
      config.run_all_when_everything_filtered = true
    end
    
    # in spec/any_spec.rb
    describe "something" do
      it "does something", :focus => true do
        # ....
      end
    end
    

提交回复
热议问题