You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*__Run Examples__ <kbd>⌘R</kbd>: Run all examples in the current spec file.
6
+
*__Run Single Example__ <kbd>⇧⌘R</kbd>: Run the example on the current line (also works for example groups).
7
+
*__Run Examples in Selected Files/Directories__ <kbd>⌥⇧⌘R</kbd>: Run all examples from the files / directories selected in the file browser. If nothing is selected, run all examples in `spec/`. Hint: <kbd>⇧⌘A ⌥⇧⌘R</kbd> is a quick way to run all specs (<kbd>⇧⌘A</kbd> deselects everything in the file browser).
8
+
*__Run Again__ <kbd>⌃⌥⌘R</kbd>: Repeat the last run command (can be example file, single example or examples in selected files).
9
+
10
+
If your project has an `.rspec` file in its root, the last two commands – “Run Examples in Selected Files/Directories” and “Run Again” – are available everywhere in your project (even in files that not using the “RSpec” mode).
11
+
12
+
# How RSpec is run
13
+
14
+
The bundle runs RSpec in a subshell. The command to start RSpec is determined as such:
15
+
16
+
* If a binstub (`bin/rspec`) is present, it is used for running RSpec (this works great for preloaders like [Spring](https://github.com/rails/spring), too).
17
+
* If there is no binstub, but `Gemfile.lock` is present, RSpec is run via `bundle exec rspec`.
18
+
* If there is neither a binstub nor a `Gemfile.lock`, RSpec is simply run via `rspec` (__not recommended__ – use only if you know exactly what you’re doing).
19
+
20
+
Internally the bundle uses `Executable.find` from the Ruby bundle to detect how to run RSpec. For details see https://github.com/textmate/ruby.tmbundle/blob/master/Support/lib/executable.rb
21
+
22
+
Running RSpec / Ruby from a subshell means that TextMate must be configured to work with whatever Ruby version manager you're using ([rbenv](https://github.com/sstephenson/rbenv), [rvm](http://rvm.io/), …). Normally, this means customizing the `$PATH` variable. See [Defining a $PATH](http://blog.macromates.com/2014/defining-a-path/) in the TextMate blog for details and caveats.
23
+
24
+
## Setting the base directory for running examples
25
+
26
+
Per default, RSpec is run from the directory currently designated as “project folder” in TextMate. This can be overriden by setting `TM_RSPEC_BASEDIR`.
27
+
28
+
It’s even possible to have different base directories for running RSpec in a single project. Take for example a Rails Engine with the following directory layout:
29
+
30
+
31
+
app/ # Rails app
32
+
spec/ # examples for the Rails app
33
+
my_engine/
34
+
app/ # Engine
35
+
spec/ # examples for the Engine
36
+
37
+
The examples for the Rails app should be run from the top-level directory, but the examples for the Engine should be run from `my_engine/`.
38
+
39
+
To achieve this, create a file `my_engine/.tm_properties` with the following line:
40
+
41
+
TM_RSPEC_BASEDIR=$CWD
42
+
43
+
This makes sure that `TM_RSPEC_BASEDIR` is set to the full path of the `my_engine/` directory whenever you’re editing a file in this directory (or one of its subdirectories). So if you’re editing `my_engine/spec/foo_spec.rb` and press <kbd>⌘R</kbd> to run the examples, they will be run from the `my_engine/` directory, while running examples in, say, `spec/bar_spec.rb` are still run from the top-level project directory.
44
+
45
+
# Configuration
46
+
47
+
In addition to the standard TextMate shell variables, the RSpec
48
+
TextMate bundle supports the following:
49
+
50
+
## TM\_RSPEC\_BASEDIR
51
+
52
+
Set the base directory for running RSpec (defaults to the current “Project Folder”). See “Setting the base directory for running examples” above for more info and an example.
53
+
54
+
## TM\_RSPEC\_FORMATTER
55
+
56
+
Set a custom formatter other than RSpec's TextMate formatter. Use
57
+
the full classname, e.g. `'Spec::Core::Formatters::WebKit'`
58
+
59
+
## TM\_RSPEC\_OPTS
60
+
61
+
Use this to set RSpec options just as you would in an `.rspec`
62
+
file.
63
+
64
+
# RVM Integration
65
+
66
+
[__NOTE: Information in this section may be outdated__]
67
+
68
+
There are lots of ways to configure TextMate to work with `rvm`,
69
+
but this is the one that we recommend:
70
+
71
+
With rvm installed, take the full path to `rvm-auto-ruby`,
72
+
found via: `which rvm-auto-ruby`
73
+
74
+
Next, set up a `TM_RUBY` option in
75
+
`TextMate/Preferences/Advanced/Shell Variables` that points to the
Copy file name to clipboardexpand all lines: README.md
+2-83
Original file line number
Diff line number
Diff line change
@@ -6,90 +6,9 @@ This bundle works with **TextMate 2** and **RSpec 3**. For TextMate 1 and/or RSp
6
6
7
7
Open up TextMate’s preferences, go to “Bundles” and make sure “RSpec” is checked.
8
8
9
-
## Running RSpec examples
9
+
## Usage
10
10
11
-
Commands for running examples:
12
-
13
-
*__Run Examples__ <kbd>⌘R</kbd>: Run all examples in the current spec file.
14
-
*__Run Single Example__ <kbd>⇧⌘R</kbd>: Run the example on the current line (also works for example groups).
15
-
*__Run Examples in Selected Files/Directories__ <kbd>⌥⇧⌘R</kbd>: Run all examples from the files / directories selected in the file browser. If nothing is selected, run all examples in `spec/`. Hint: <kbd>⇧⌘A ⌥⇧⌘R</kbd> is a quick way to run all specs (<kbd>⇧⌘A</kbd> deselects everything in the file browser).
16
-
*__Run Again__ <kbd>⌃⌥⌘R</kbd>: Repeat the last run command (can be example file, single example or examples in selected files).
17
-
18
-
If your project has an `.rspec` file in its root, the last two commands – “Run Examples in Selected Files/Directories” and “Run Again” – are available everywhere in your project (even in files that not using the “RSpec” mode).
19
-
20
-
## Configuring TextMate for running examples
21
-
22
-
The bundle runs RSpec in a subshell. The command to start RSpec is determined as such:
23
-
24
-
* If a binstub (`bin/rspec`) is present, it is used for running RSpec (this works great for preloaders like [Spring](https://github.com/rails/spring), too).
25
-
* If there is no binstub, but `Gemfile.lock` is present, RSpec is run via `bundle exec rspec`.
26
-
* If there is neither a binstub nor a `Gemfile.lock`, RSpec is simply run via `rspec` (__not recommended__ – use only if you know exactly what you’re doing).
27
-
28
-
Internally the bundle uses `Executable.find` from the Ruby bundle to detect how to run RSpec. For details see https://github.com/textmate/ruby.tmbundle/blob/master/Support/lib/executable.rb
29
-
30
-
Running RSpec / Ruby from a subshell means that TextMate must be configured to work with whatever Ruby version manager you're using ([rbenv](https://github.com/sstephenson/rbenv), [rvm](http://rvm.io/), …). Normally, this means customizing the `$PATH` variable. See [Defining a $PATH](http://blog.macromates.com/2014/defining-a-path/) in the TextMate blog for details and caveats.
31
-
32
-
### Setting the base directory for running examples
33
-
34
-
Per default, RSpec is run from the directory currently designated as “project folder” in TextMate. This can be overriden by setting `TM_RSPEC_BASEDIR`.
35
-
36
-
It’s even possible to have different base directories for running RSpec in a single project. Take for example a Rails Engine with the following directory layout:
37
-
38
-
```
39
-
app/ # Rails app
40
-
spec/ # examples for the Rails app
41
-
my_engine/
42
-
app/ # Engine
43
-
spec/ # examples for the Engine
44
-
```
45
-
46
-
The examples for the Rails app should be run from the top-level directory, but the examples for the Engine should be run from `my_engine/`.
47
-
48
-
To achieve this, create a file `my_engine/.tm_properties` with the following line:
49
-
50
-
```
51
-
TM_RSPEC_BASEDIR=$CWD
52
-
```
53
-
54
-
This makes sure that `TM_RSPEC_BASEDIR` is set to the full path of the `my_engine/` directory whenever you’re editing a file in this directory (or one of its subdirectories). So if you’re editing `my_engine/spec/foo_spec.rb` and press <kbd>⌘R</kbd> to run the examples, they will be run from the `my_engine/` directory, while running examples in, say, `spec/bar_spec.rb` are still run from the top-level project directory.
55
-
56
-
## Configuration
57
-
58
-
In addition to the standard TextMate shell variables, the RSpec
59
-
TextMate bundle supports the following:
60
-
61
-
#### TM\_RSPEC\_BASEDIR
62
-
63
-
Set the base directory for running RSpec (defaults to the current “Project Folder”). See “Setting the base directory for running examples” above for more info and an example.
64
-
65
-
#### TM\_RSPEC\_FORMATTER
66
-
67
-
Set a custom formatter other than RSpec's TextMate formatter. Use
68
-
the full classname, e.g. `'Spec::Core::Formatters::WebKit'`
69
-
70
-
#### TM\_RSPEC\_OPTS
71
-
72
-
Use this to set RSpec options just as you would in an `.rspec`
73
-
file.
74
-
75
-
## RVM Integration
76
-
77
-
[__NOTE: Information in this section may be outdated__]
78
-
79
-
There are lots of ways to configure TextMate to work with `rvm`,
80
-
but this is the one that we recommend:
81
-
82
-
With rvm installed, take the full path to `rvm-auto-ruby`,
83
-
found via: `which rvm-auto-ruby`
84
-
85
-
Next, set up a `TM_RUBY` option in
86
-
`TextMate/Preferences/Advanced/Shell Variables` that points to the
0 commit comments