Skip to content

Instantly share code, notes, and snippets.

@stephaneliu
Created September 5, 2020 23:54
Show Gist options
  • Save stephaneliu/04629f6e6c94bd11efc8f6976cc6a3d5 to your computer and use it in GitHub Desktop.
Save stephaneliu/04629f6e6c94bd11efc8f6976cc6a3d5 to your computer and use it in GitHub Desktop.
class Test < Thor
include Thor::Actions
desc "insert", "an example"
def insert
content = <<~EOL
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }\n\n
EOL
insert_into_file("spec/rails_helper.rb", content, before: "RSpec.configure do")
end
desc "uncomment", "an example"
def uncomment
uncomment_lines("spec/spec_helper.rb", /disable_monkey/)
uncomment_lines("spec/spec_helper.rb", /filter_run_when_matching/)
uncomment_lines("spec/spec_helper.rb", /example_status_persistence_file_path/)
end
end
@stephaneliu
Copy link
Author

thor test:insert
or
thor test:uncomment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment