File tree Expand file tree Collapse file tree 4 files changed +32
-7
lines changed Expand file tree Collapse file tree 4 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ already ran. For example:
38
38
it "does something" do
39
39
expect(@widget).to do_something
40
40
end
41
-
41
+
42
42
it "does something else" do
43
43
expect(@widget).to do_something_else
44
44
end
@@ -47,7 +47,7 @@ already ran. For example:
47
47
The ` @widget ` is recreated in each of the two examples above, so each example
48
48
has a different object, _ and_ the underlying data is rolled back so the data
49
49
backing the ` @widget ` in each example is new.
50
-
50
+
51
51
### Data created in ` before(:all) ` are _ not_ rolled back
52
52
53
53
` before(:all) ` hooks are invoked before the transaction is opened. You can use
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ the following guidelines:
13
13
* Access cookies through the ` request ` and ` response ` objects in the spec.
14
14
* Use ` request.cookies ` before the action to set up state.
15
15
* Use ` response.cookies ` after the action to specify outcomes.
16
- * Use the ` cookies ` object in the controller action.
16
+ * Use the ` cookies ` object in the controller action.
17
17
* Use String keys.
18
18
19
19
<pre >
@@ -42,7 +42,7 @@ sticking with string keys for consistency.
42
42
43
43
The ` cookies ` method combines the ` request ` and ` response ` cookies. This can
44
44
lead to confusion when setting cookies in the example in order to set up state
45
- for the controller action.
45
+ for the controller action.
46
46
47
47
# does not work in rails 3.0.0 > 3.1.0
48
48
cookies['foo'] = 'bar' # this is not visible in the controller
@@ -51,7 +51,6 @@ for the controller action.
51
51
### Future versions of Rails
52
52
53
53
There is code in the master branch in rails that makes cookie access more
54
- consistent so you can use the same ` cookies ` object before and after the action,
54
+ consistent so you can use the same ` cookies ` object before and after the action,
55
55
and you can use String or Symbol keys. We'll update these docs accordingly when
56
56
that is released.
57
-
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Feature: be_a_new matcher
6
6
You can also chain `with` on `be_a_new` with a hash of attributes to specify
7
7
the subject has equal attributes.
8
8
9
- Scenario : example spec with four be_a_new possibilities
9
+ Scenario : example spec with four be_a_new possibilities
10
10
Given a file named "spec/models/widget_spec.rb" with:
11
11
"""ruby
12
12
require "rails_helper"
Original file line number Diff line number Diff line change
1
+ require 'rspec/support/spec/library_wide_checks'
2
+
3
+ RSpec . describe "RSpec::Rails" do
4
+ include RSpec ::Support ::WhitespaceChecks
5
+
6
+ # Pasted from rspec-support lib/rspec/support/spec/library_wide_checks.rb:134
7
+ # Easier to do that here than to extract it out
8
+ RSpec ::Matchers . define :be_well_formed do
9
+ match do |actual |
10
+ actual . empty?
11
+ end
12
+
13
+ failure_message do |actual |
14
+ actual . join ( "\n " )
15
+ end
16
+ end
17
+
18
+ it "has no malformed whitespace" , :slow do
19
+ error_messages = [ ]
20
+ `git ls-files -z` . split ( "\x0 " ) . each do |filename |
21
+ error_messages << check_for_tab_characters ( filename )
22
+ error_messages << check_for_extra_spaces ( filename )
23
+ end
24
+ expect ( error_messages . compact ) . to be_well_formed
25
+ end
26
+ end
You can’t perform that action at this time.
0 commit comments