Focus on single rspec test without running whole suite
# in spec/spec_helper.rb
RSpec.configure do |c|
c.filter_run :focus => true
end
# in spec/any_spec.rb
describe "something" do
it "does something", :focus => true do
# ....
end
end
As @mcansky clarified in comments, "the "trick" is the ":focus => true" part, it comes with Rspec 2.x.".
Written by Adam Stankiewicz
Related protips
4 Responses
the "trick" is the ":focus => true" part, it comes with Rspec 2.x.
over 1 year ago
·
@mcansky Thank you for clarification. I've updated the protip to include your comment.
over 1 year ago
·
@sheerun you're welcome.
note : if I remember correctly "focus" is an edge case of the tag functionality that was added to rspec 2 : https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option
over 1 year ago
·
You can run the it directly with $ rspec spec/any_spec.rb:10
where 10 is the line number of the spec you want to run.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#