@@ -17,44 +17,44 @@ def test_generated_controller
17
17
18
18
assert_file 'app/controllers/accounts_controller.rb' do |content |
19
19
assert_instance_method :index , content do |m |
20
- assert_match /@accounts = Account\. all/ , m
21
- assert_match /format.html/ , m
22
- assert_match /format.json \{ render json: @accounts \} / , m
20
+ assert_match ( /@accounts = Account\. all/ , m )
21
+ assert_match ( /format.html/ , m )
22
+ assert_match ( /format.json \{ render json: @accounts \} / , m )
23
23
end
24
24
25
25
assert_instance_method :show , content do |m |
26
- assert_match /format.html/ , m
27
- assert_match /format.json \{ render json: @account \} / , m
26
+ assert_match ( /format.html/ , m )
27
+ assert_match ( /format.json \{ render json: @account \} / , m )
28
28
end
29
29
30
30
assert_instance_method :new , content do |m |
31
- assert_match /@account = Account\. new/ , m
31
+ assert_match ( /@account = Account\. new/ , m )
32
32
end
33
33
34
34
assert_instance_method :edit , content do |m |
35
- assert m . blank?
35
+ assert_predicate m , : blank?
36
36
end
37
37
38
38
assert_instance_method :create , content do |m |
39
- assert_match /@account = Account\. new\( account_params\) / , m
40
- assert_match /@account\. save/ , m
41
- assert_match /format\. html \{ redirect_to @account, notice: 'Account was successfully created\. ' \} / , m
42
- assert_match /format\. json \{ render json: @account, status: :created \} / , m
43
- assert_match /format\. html \{ render action: 'new' \} / , m
44
- assert_match /format\. json \{ render json: @account\. errors, status: :unprocessable_entity \} / , m
39
+ assert_match ( /@account = Account\. new\( account_params\) / , m )
40
+ assert_match ( /@account\. save/ , m )
41
+ assert_match ( /format\. html \{ redirect_to @account, notice: 'Account was successfully created\. ' \} / , m )
42
+ assert_match ( /format\. json \{ render json: @account, status: :created \} / , m )
43
+ assert_match ( /format\. html \{ render action: 'new' \} / , m )
44
+ assert_match ( /format\. json \{ render json: @account\. errors, status: :unprocessable_entity \} / , m )
45
45
end
46
46
47
47
assert_instance_method :update , content do |m |
48
- assert_match /format\. html \{ redirect_to @account, notice: 'Account was successfully updated\. ' \} / , m
49
- assert_match /format\. json \{ head :no_content \} / , m
50
- assert_match /format\. html \{ render action: 'edit' \} / , m
51
- assert_match /format\. json \{ render json: @account.errors, status: :unprocessable_entity \} / , m
48
+ assert_match ( /format\. html \{ redirect_to @account, notice: 'Account was successfully updated\. ' \} / , m )
49
+ assert_match ( /format\. json \{ head :no_content \} / , m )
50
+ assert_match ( /format\. html \{ render action: 'edit' \} / , m )
51
+ assert_match ( /format\. json \{ render json: @account.errors, status: :unprocessable_entity \} / , m )
52
52
end
53
53
54
54
assert_instance_method :destroy , content do |m |
55
- assert_match /@account\. destroy/ , m
56
- assert_match /format\. html { redirect_to accounts_url \} / , m
57
- assert_match /format\. json \{ head :no_content \} / , m
55
+ assert_match ( /@account\. destroy/ , m )
56
+ assert_match ( /format\. html { redirect_to accounts_url \} / , m )
57
+ assert_match ( /format\. json \{ head :no_content \} / , m )
58
58
end
59
59
60
60
assert_match ( /def account_params/ , content )
0 commit comments