README.md in rspec_profiling-0.0.6 vs README.md in rspec_profiling-0.0.7
- old
+ new
@@ -3,10 +3,11 @@
Collects profiles of RSpec test suites, enabling you to identify specs
with interesting attributes. For example, find the slowest specs, or the
spec which issues the most queries.
Collected attributes include:
+
- git commit SHA (or SVN revision) and date
- example file, line number and description
- example status (i.e. passed or failed)
- example exception (i.e. nil if passed, reason for failure otherwise)
- example time
@@ -19,33 +20,40 @@
## Installation
Add this line to your application's Gemfile:
-```
+```ruby
gem 'rspec_profiling'
```
And then execute:
-```
+```bash
bundle
```
Require the gem to your `spec_helper.rb`.
-```
+```ruby
require "rspec_profiling/rspec"
```
Lastly, run the installation rake tasks to initialize an empty database in
which results will be collected.
-```
+```bash
bundle exec rake rspec_profiling:install
```
+If you are planning on using `sqlite` or `pg` ensure to add the dependency to your gemfile
+
+```ruby
+ gem 'sqlite', require: false
+ gem 'pg', require: false
+```
+
## Usage
### Choose a version control system
Results are collected based on the version control system employed e.g. revision or commit SHA for `svn` and `git` respectively.
@@ -72,49 +80,81 @@
RspecProfiling.configure do |config|
config.vcs = RspecProfiling::VCS::GitSvn
end
```
+#### Custom Event Subscriptions
+
+```Ruby
+RspecProfiling.configure do |config|
+ config.events = %w[event1 event2]
+end
+```
+
+Note that custom events are only currently reported by the CSV collector.
+
+#### Custom Event Recording
+
+It is possible to record the event metadata for a spec.
+
+```Ruby
+ describe 'Records all active record queries', record_events: %w[sql.active_record] do
+ it 'Records Rails deprecations', record_events: %w[deprecation.rails] do
+ ...
+ end
+ it 'Records nothing' do
+ ...
+ end
+ end
+```
+
### Choose a results collector
Results are collected just by running the specs.
#### SQLite3
-By default, profiles are collected in an SQL database. Make sure you've
-run the installation rake task before attempting.
+Make sure you've run the installation rake task before attempting.
+You can configure `RspecProfiling` to collect results in a SQL database in `config/initializers/rspec_profiling.rb`:
+
+```Ruby
+RspecProfiling.configure do |config|
+ config.collector = RspecProfiling::Collectors::SQL
+end
+```
+
You can review results by running the RspecProfiling console.
The console has a preloaded `results` variable.
-```
+```bash
bundle exec rake rspec_profiling:console
> results.count
=> 1970
```
You can find the spec that runs the most queries:
-```
+```ruby
> results.order(:query_count).last.to_s
=> "Updating my account - ./spec/features/account_spec.rb:15"
```
Or find the spec that takes the most time:
-```
+```ruby
> results.order(:time).last.to_s
=> "Updating my account - ./spec/features/account_spec.rb:15"
```
There are additional attributes available on the `Result` instances to enable
debugging, such as `exception` and `status`.
#### CSV
-You can configure `RspecProfiling` to collect results in a CSV in `config/initializers/rspec_profiling.rb`:
+By default, profiles are collected in an a CSV file. You can configure `RspecProfiling` to collect results in a CSV in `config/initializers/rspec_profiling.rb`:
```Ruby
RspecProfiling.configure do |config|
config.collector = RspecProfiling::Collectors::CSV
end
@@ -175,18 +215,20 @@
To remove the results database, run `bundle exec rake rspec_profiling:uninstall`.
## Contributing
-1. Fork it
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
+Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
-## About Breakwater
+## Local Development
-![Breakwater Logo](https://images.squarespace-cdn.com/content/5d084fe43b0b620001239437/1565926359217-2LQ1BOFAO5846OAYAGZV/breakwater.png?content-type=image%2Fpng)
+Local tools needed:
-Breakwater builds exciting web and mobile apps in Louisville, CO. Our work powers a wide variety of businesses with many different needs. We love open source software, and we're proud to contribute where we can. Interested to learn more? [Contact us today](https://www.breakwaterltd.com/contact).
+- docker
+- docker-compose
+- ruby
-This project is maintained by Breakwater. The names and logos of Breakwater are fully owned and copyright Breakwater Limited.
+To run the specs:
+
+```bash
+make spec
+```