README.md in rspec_profiling-0.0.3 vs README.md in rspec_profiling-0.0.4

- old
+ new

@@ -1,6 +1,6 @@ -# RSpecProfiling +# RspecProfiling 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. @@ -13,11 +13,11 @@ - query count and time - request count and time ## Compatibility -RSpecProfiling should work with Rails >= 3.2 and RSpec >= 2.14. +RspecProfiling should work with Rails >= 3.2 and RSpec >= 2.14. ## Installation Add this line to your application's Gemfile: @@ -44,20 +44,48 @@ bundle exec rake rspec_profiling:install ``` ## 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. + +#### Git + +By default, RspecProfiling expects Git as the version control system. + +#### Subversion + +RspecProfiling can be configured to use `svn` in `config/initializers/rspec_profiling.rb`: + +```Ruby +RspecProfiling.configure do |config| + config.vcs = RspecProfiling::VCS::Svn +end +``` + +#### Git / Subversion + +For those with a mixed project, with some developers using `git svn` and others regular `svn`, use this configuration to detect which is being used locally and behave accordingly. + +```Ruby +RspecProfiling.configure do |config| + config.vcs = RspecProfiling::VCS::GitSvn +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. -You can review results by running the RSpecProfiling console. +You can review results by running the RspecProfiling console. ``` bundle exec rake rspec_profiling:console > results.count @@ -74,53 +102,60 @@ > 180 ``` #### CSV -You can configure `RSpecProfiling` to collect results in a CSV in your -`spec_helper.rb` 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 +RspecProfiling.configure do |config| + config.collector = RspecProfiling::Collectors::CSV end - -require "rspec_profiling/rspec" ``` By default, the CSV is output to `cat tmp/spec_benchmarks.csv`. Rerunning spec will overwrite the file. You can customize the CSV path to, for example, include the sample time. ```Ruby -RSpecProfiling.configure do |config| - config.collector = RSpecProfiling::Collectors::CSV +RspecProfiling.configure do |config| + config.collector = RspecProfiling::Collectors::CSV config.csv_path = ->{ "tmp/spec_benchmark_#{Time.now.to_i}" } end +``` -require "rspec_profiling/rspec" +#### Postgresql + +You can configure `RspecProfiling` to collect results in a Postgres database +in your `spec_helper.rb` file. + +```Ruby +RspecProfiling.configure do |config| + config.collector = RspecProfiling::Collectors::PSQL + config.db_path = 'profiling' +end ``` ## Configuration Options Configuration is performed like this: ```Ruby -RSpecProfiling.configure do |config| +RspecProfiling.configure do |config| config.<option> = <something> end ``` ### Options - `db_path` - the location of the SQLite database file - `table_name` - the database table name in which results are stored - `csv_path` - the directory in which CSV files are dumped +- `collector` - collector to use ## Uninstalling -To remove the results database, run `bundle exec rake -rspec_profiling:uninstall`. +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`)