Project

General

Profile

Patch #31506 » 0004-Remove-trailing-whitespaces-from-test.patch

Marius BĂLTEANU, 2019-06-03 21:59

View differences:

test/functional/account_controller_openid_test.rb
170 170
              :lastname => 'User',
171 171
              :mail => 'user@somedomain.com',
172 172
              :identity_url => 'http://openid.example.com/good_blank_user'
173
              
173

  
174 174
            }
175 175
          }
176 176
        assert_response 302
test/functional/account_controller_test.rb
312 312
              :firstname => 'John',
313 313
              :lastname => 'Doe',
314 314
              :mail => 'register@example.com'
315
              
315

  
316 316
            }
317 317
          }
318 318
        assert_redirected_to '/my/account'
......
326 326
      assert user.active?
327 327
    end
328 328
  end
329
  
329

  
330 330
  def test_post_register_with_registration_off_should_redirect
331 331
    with_settings :self_registration => '0' do
332 332
      assert_no_difference 'User.count' do
......
338 338
              :firstname => 'John',
339 339
              :lastname => 'Doe',
340 340
              :mail => 'register@example.com'
341
              
341

  
342 342
            }
343 343
          }
344 344
        assert_redirected_to '/'
......
357 357
              :firstname => 'John',
358 358
              :lastname => 'Doe',
359 359
              :mail => 'register@example.com'
360
              
361
            },  
360

  
361
            },
362 362
            :pref => {
363 363
              :hide_mail => '1'
364
              
364

  
365 365
            }
366 366
          }
367 367
      end
test/functional/activities_controller_test.rb
143 143
          :show_issues => '1'
144 144
        }
145 145
      assert_response :success
146
  
146

  
147 147
      assert_select 'title', :text => /Issues/
148 148
    end
149 149
  end
test/functional/comments_controller_test.rb
31 31
    post :create, :params => {
32 32
        :id => 1,
33 33
        :comment => {
34
          :comments => 'This is a test comment' 
34
          :comments => 'This is a test comment'
35 35
        }
36 36
      }
37 37
    assert_redirected_to '/news/1'
......
48 48
      post :create, :params => {
49 49
          :id => 1,
50 50
          :comment => {
51
            :comments => '' 
51
            :comments => ''
52 52
          }
53 53
        }
54 54
      assert_response :redirect
......
63 63
      post :create, :params => {
64 64
          :id => 1,
65 65
          :comment => {
66
            :comments => 'This is a test comment' 
66
            :comments => 'This is a test comment'
67 67
          }
68 68
        }
69 69
      assert_response 403
test/functional/context_menus_controller_test.rb
319 319
  def test_time_entries_context_menu_without_edit_permission
320 320
    @request.session[:user_id] = 2
321 321
    Role.find_by_name('Manager').remove_permission! :edit_time_entries
322
    
322

  
323 323
    get :time_entries, :params => {
324 324
        :ids => [1, 2]
325 325
      }
test/functional/custom_field_enumerations_controller_test.rb
47 47
      post :create, :params => {
48 48
          :custom_field_id => @field.id,
49 49
          :custom_field_enumeration => {
50
            :name => 'Baz' 
50
            :name => 'Baz'
51 51
          }
52 52
        }
53 53
      assert_redirected_to "/custom_fields/#{@field.id}/enumerations"
......
65 65
      post :create, :params => {
66 66
          :custom_field_id => @field.id,
67 67
          :custom_field_enumeration => {
68
            :name => 'Baz' 
68
            :name => 'Baz'
69 69
          }
70 70
        },
71 71
        :xhr => true
......
81 81
            :position => "1",
82 82
            :name => "Baz",
83 83
            :active => "1"
84
          },    
84
          },
85 85
          @foo.id.to_s => {
86 86
            :position => "2",
87 87
            :name => "Foo",
88 88
            :active => "0"
89
          }    
90
          
89
          }
90

  
91 91
        }
92 92
      }
93 93
    assert_response 302
test/functional/custom_fields_controller_test.rb
193 193
        :type => 'IssueCustomField',
194 194
        :custom_field => {
195 195
          :field_format => 'list'
196
        },  
196
        },
197 197
        :format => 'js'
198 198
      },
199 199
      :xhr => true
......
247 247
            :field_format => "string",
248 248
            :is_for_all => "0",
249 249
            :project_ids => ["1", "3", ""]
250
            
250

  
251 251
          }
252 252
        }
253 253
      assert_response 302
test/functional/files_controller_test.rb
84 84
            :version_id => '',
85 85
            :attachments => {
86 86
              '1' => {
87
              'file' => uploaded_test_file('testfile.txt', 'text/plain')}    
87
              'file' => uploaded_test_file('testfile.txt', 'text/plain')}
88 88
            }
89 89
          }
90 90
        assert_response :redirect
......
111 111
          :version_id => '2',
112 112
          :attachments => {
113 113
            '1' => {
114
            'file' => uploaded_test_file('testfile.txt', 'text/plain')}    
114
            'file' => uploaded_test_file('testfile.txt', 'text/plain')}
115 115
          }
116 116
        }
117 117
      assert_response :redirect
test/functional/groups_controller_test.rb
102 102
      post :create, :params => {
103 103
          :group => {
104 104
            :name => 'New group'
105
          },  
105
          },
106 106
          :continue => 'Create and continue'
107 107
        }
108 108
    end
test/functional/issue_categories_controller_test.rb
125 125
      put :update, :params => {
126 126
          :id => 2,
127 127
          :issue_category => {
128
            :name => 'Testing' 
128
            :name => 'Testing'
129 129
          }
130 130
        }
131 131
    end
......
137 137
    put :update, :params => {
138 138
        :id => 2,
139 139
        :issue_category => {
140
          :name => '' 
140
          :name => ''
141 141
        }
142 142
      }
143 143
    assert_response :success
......
148 148
    put :update, :params => {
149 149
        :id => 97,
150 150
        :issue_category => {
151
          :name => 'Testing' 
151
          :name => 'Testing'
152 152
        }
153 153
      }
154 154
    assert_response 404
test/functional/issue_statuses_controller_test.rb
32 32
    assert_response :success
33 33
    assert_select 'table.issue_statuses'
34 34
  end
35
  
35

  
36 36
  def test_index_by_anonymous_should_redirect_to_login_form
37 37
    @request.session[:user_id] = nil
38 38
    get :index
39 39
    assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses'
40 40
  end
41
  
41

  
42 42
  def test_index_by_user_should_respond_with_406
43 43
    @request.session[:user_id] = 2
44 44
    get :index
test/functional/issues_controller_transaction_test.rb
64 64
              :fixed_version_id => 4,
65 65
              :notes => 'My notes',
66 66
              :lock_version => (issue.lock_version - 1)
67
              
68
            },  
67

  
68
            },
69 69
            :time_entry => {
70 70
              :hours => '2.5',
71 71
              :comments => '',
72
              :activity_id => TimeEntryActivity.first.id 
72
              :activity_id => TimeEntryActivity.first.id
73 73
            }
74 74
          }
75 75
      end
......
100 100
                :fixed_version_id => 4,
101 101
                :notes => 'My notes',
102 102
                :lock_version => (issue.lock_version - 1)
103
                
104
              },  
103

  
104
              },
105 105
              :attachments => {
106 106
                '1' => {
107
                'file' => uploaded_test_file('testfile.txt', 'text/plain')}    
108
              },  
107
                'file' => uploaded_test_file('testfile.txt', 'text/plain')}
108
              },
109 109
              :time_entry => {
110 110
                :hours => '2.5',
111 111
                :comments => '',
112
                :activity_id => TimeEntryActivity.first.id 
112
                :activity_id => TimeEntryActivity.first.id
113 113
              }
114 114
            }
115 115
        end
......
133 133
          :fixed_version_id => 4,
134 134
          :notes => '',
135 135
          :lock_version => (issue.lock_version - 1)
136
          
136

  
137 137
        }
138 138
      }
139 139
    assert_response :success
......
153 153
          :fixed_version_id => 4,
154 154
          :notes => '',
155 155
          :lock_version => 2
156
          
157
        },  
156

  
157
        },
158 158
        :last_journal_id => 1
159 159
      }
160 160
    assert_response :success
......
172 172
          :fixed_version_id => 4,
173 173
          :notes => '',
174 174
          :lock_version => 2
175
          
176
        },  
175

  
176
        },
177 177
        :last_journal_id => ''
178 178
      }
179 179
    assert_response :success
......
192 192
        :issue => {
193 193
          :fixed_version_id => 4,
194 194
          :lock_version => 2
195
        },  
195
        },
196 196
        :last_journal_id => ''
197 197
      }
198 198
    assert_response :success
......
204 204
        :issue => {
205 205
          :fixed_version_id => 4,
206 206
          :lock_version => 2
207
        },  
207
        },
208 208
        :last_journal_id => ''
209 209
      }
210 210
    assert_response :success
......
221 221
            :fixed_version_id => 4,
222 222
            :notes => 'overwrite_conflict_resolution',
223 223
            :lock_version => 2
224
            
225
          },  
224

  
225
          },
226 226
          :conflict_resolution => 'overwrite'
227 227
        }
228 228
    end
......
245 245
            :fixed_version_id => 4,
246 246
            :notes => 'add_notes_conflict_resolution',
247 247
            :lock_version => 2
248
            
249
          },  
248

  
249
          },
250 250
          :conflict_resolution => 'add_notes'
251 251
        }
252 252
    end
......
271 271
            :notes => 'add_privates_notes_conflict_resolution',
272 272
            :private_notes => '1',
273 273
            :lock_version => 2
274
            
275
          },  
274

  
275
          },
276 276
          :conflict_resolution => 'add_notes'
277 277
        }
278 278
    end
......
293 293
            :fixed_version_id => 4,
294 294
            :notes => 'add_notes_conflict_resolution',
295 295
            :lock_version => 2
296
            
297
          },  
296

  
297
          },
298 298
          :conflict_resolution => 'cancel'
299 299
        }
300 300
    end
......
311 311
      put :update, :params => {
312 312
          :id => 1,
313 313
          :issue => {
314
            :subject => '' 
315
          },  
314
            :subject => ''
315
          },
316 316
          :time_entry => {
317 317
            :hours => '2.5',
318 318
            :comments => 'should not be added',
319
            :activity_id => TimeEntryActivity.first.id 
319
            :activity_id => TimeEntryActivity.first.id
320 320
          }
321 321
        }
322 322
      assert_response :success
test/functional/issues_custom_fields_visibility_test.rb
174 174
          :id => @issue.id,
175 175
          :issue => {
176 176
            :custom_field_values => {
177
            @field1.id.to_s => "User#{user.id}Value0",    
178
                    @field2.id.to_s => "User#{user.id}Value1",  
177
            @field1.id.to_s => "User#{user.id}Value0",
178
                    @field2.id.to_s => "User#{user.id}Value1",
179 179
                  @field3.id.to_s => "User#{user.id}Value2",
180 180
                }
181 181
        }
......
281 281
              :priority_id => 5,
282 282
              :custom_field_values => {
283 283
                @field1.id.to_s => 'Value0', @field2.id.to_s => 'Value1', @field3.id.to_s => 'Value2'
284
              },    
284
              },
285 285
              :watcher_user_ids => users_to_test.keys.map(&:id)
286
              
286

  
287 287
            }
288 288
          }
289 289
        assert_response 302
......
321 321
          :issue => {
322 322
            :custom_field_values => {
323 323
              @field1.id.to_s => 'NewValue0', @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
324
            }    
325
            
324
            }
325

  
326 326
          }
327 327
        }
328 328
      assert_response 302
......
358 358
          :issue => {
359 359
            :custom_field_values => {
360 360
              @field2.id.to_s => 'NewValue1', @field3.id.to_s => 'NewValue2'
361
            }    
362
            
361
            }
362

  
363 363
          }
364 364
        }
365 365
      assert_response 302
test/functional/news_controller_test.rb
118 118
          :news => {
119 119
            :title => 'NewsControllerTest',
120 120
            :description => 'This is the description',
121
            :summary => '' 
121
            :summary => ''
122 122
          }
123 123
        }
124 124
    end
......
141 141
            :project_id => 1,
142 142
            :news => {
143 143
              :title => 'Test',
144
              :description => 'This is the description' 
145
            },  
144
              :description => 'This is the description'
145
            },
146 146
            :attachments => {
147 147
              '1' => {
148
              'file' => uploaded_test_file('testfile.txt', 'text/plain')}    
148
              'file' => uploaded_test_file('testfile.txt', 'text/plain')}
149 149
            }
150 150
          }
151 151
      end
......
162 162
        :news => {
163 163
          :title => '',
164 164
          :description => 'This is the description',
165
          :summary => '' 
165
          :summary => ''
166 166
        }
167 167
      }
168 168
    assert_response :success
......
183 183
    put :update, :params => {
184 184
        :id => 1,
185 185
        :news => {
186
          :description => 'Description changed by test_post_edit' 
186
          :description => 'Description changed by test_post_edit'
187 187
        }
188 188
      }
189 189
    assert_redirected_to '/news/1'
......
199 199
        put :update, :params => {
200 200
            :id => 1,
201 201
            :news => {
202
              :description => 'This is the description' 
203
            },  
202
              :description => 'This is the description'
203
            },
204 204
            :attachments => {
205 205
              '1' => {
206
              'file' => uploaded_test_file('testfile.txt', 'text/plain')}    
206
              'file' => uploaded_test_file('testfile.txt', 'text/plain')}
207 207
            }
208 208
          }
209 209
      end
......
217 217
    put :update, :params => {
218 218
        :id => 1,
219 219
        :news => {
220
          :description => '' 
220
          :description => ''
221 221
        }
222 222
      }
223 223
    assert_response :success
test/functional/principal_memberships_controller_test.rb
116 116
          :membership => {
117 117
            :project_ids => [3],
118 118
            :role_ids => [2]
119
          },  
119
          },
120 120
          :format => 'js'
121 121
        },
122 122
        :xhr => true
......
136 136
          :user_id => 7,
137 137
          :membership => {
138 138
            :project_ids => [3]
139
          },  
139
          },
140 140
          :format => 'js'
141 141
        },
142 142
        :xhr => true
......
186 186
          :id => 1,
187 187
          :membership => {
188 188
            :role_ids => [2]
189
          },  
189
          },
190 190
          :format => 'js'
191 191
        },
192 192
        :xhr => true
test/functional/repositories_controller_test.rb
56 56
      assert_select 'option[value=Git]:not([selected])'
57 57
    end
58 58
  end
59
 
59

  
60 60
  def test_get_new_with_type
61 61
    @request.session[:user_id] = 1
62 62
    get :new, :params => {
test/functional/repositories_git_controller_test.rb
63 63
            :is_default => '0',
64 64
            :identifier => 'test-create',
65 65
            :report_last_commit => '1',
66
                                 
66

  
67 67
          }
68 68
        }
69 69
    end
......
77 77
        :id => repository.id,
78 78
        :repository => {
79 79
          :report_last_commit => '0'
80
          
80

  
81 81
        }
82 82
      }
83 83
    assert_response 302
test/functional/roles_controller_test.rb
222 222
  def test_destroy_role_in_use
223 223
    delete :destroy, :params => {:id => 1}
224 224
    assert_redirected_to '/roles'
225
    assert_equal 'This role is in use and cannot be deleted.', flash[:error] 
225
    assert_equal 'This role is in use and cannot be deleted.', flash[:error]
226 226
    assert_not_nil Role.find_by_id(1)
227 227
  end
228 228

  
test/helpers/journals_helper_test.rb
33 33

  
34 34
  def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
35 35
    issue = Issue.generate!
36
    
36

  
37 37
    journal = new_record(Journal) do
38 38
      issue.init_journal(User.find(1))
39 39
      issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'image.png'), :author => User.find(1))
test/integration/account_test.rb
60 60
      assert_equal 'autologin', token.action
61 61
      assert_equal user.id, session[:user_id]
62 62
      assert_equal token.value, cookies['autologin']
63
  
63

  
64 64
      # Session is cleared
65 65
      reset!
66 66
      User.current = nil
67 67
      # Clears user's last login timestamp
68 68
      user.update_attribute :last_login_on, nil
69 69
      assert_nil user.reload.last_login_on
70
  
70

  
71 71
      # User comes back with user's autologin cookie
72 72
      cookies[:autologin] = token.value
73 73
      get '/my/page'
test/integration/admin_test.rb
53 53
    put "/users/#{user.id}", :params => {
54 54
        :id => user.id,
55 55
        :user => {
56
          :status => User::STATUS_LOCKED 
56
          :status => User::STATUS_LOCKED
57 57
        }
58 58
      }
59 59
    assert_redirected_to "/users/#{ user.id }/edit"
test/integration/api_test/issue_categories_test.rb
97 97
    assert_equal '', @response.body
98 98
    assert_nil IssueCategory.find_by_id(1)
99 99
  end
100
    
100

  
101 101
  test "DELETE /issue_categories/:id.xml should reassign issues with :reassign_to_id param" do
102 102
    issue_count = Issue.where(:category_id => 1).count
103 103
    assert issue_count > 0
test/integration/api_test/search_test.rb
91 91
    assert_equal 4, json['limit']
92 92
    assert_equal issue[8..10], json['results'].map {|r| r['id']}
93 93
  end
94
 
94

  
95 95
  test "GET /search.xml should not quick jump to the issue with given id" do
96 96
    get '/search.xml', :params => {:q => '3'}
97 97
    assert_response :success
test/integration/issues_test.rb
130 130
      get '/projects/ecookbook/issues?set_filter=1&group_by=fixed_version&sort=priority:desc,fixed_version,id'
131 131
      assert_response :success
132 132
      assert_select 'td.id', :text => '5'
133
  
133

  
134 134
      get '/issues/5'
135 135
      assert_response :success
136 136
      assert_select '.next-prev-links .position', :text => '5 of 6'
......
142 142
      get '/projects/ecookbook/issues?set_filter=1&tracker_id=1'
143 143
      assert_response :success
144 144
      assert_select 'td.id', :text => '5'
145
  
145

  
146 146
      get '/issues/5'
147 147
      assert_response :success
148 148
      assert_select '.next-prev-links .position', :text => '3 of 5'
......
160 160
      get "/projects/ecookbook/issues?set_filter=1&query_id=#{query.id}"
161 161
      assert_response :success
162 162
      assert_select 'td.id', :text => '5'
163
  
163

  
164 164
      get '/issues/5'
165 165
      assert_response :success
166 166
      assert_select '.next-prev-links .position', :text => '6 of 8'
test/integration/sudo_mode_test.rb
186 186
            }
187 187
          },
188 188
          :headers => credentials('admin')
189
  
189

  
190 190
        assert_response :created
191 191
      end
192 192
    end
test/system/issues_test.rb
50 50
    # check issue attributes
51 51
    assert_equal 'jsmith', issue.author.login
52 52
    assert_equal 1, issue.project.id
53
    assert_equal IssueStatus.find_by_name('New'), issue.status 
53
    assert_equal IssueStatus.find_by_name('New'), issue.status
54 54
    assert_equal Tracker.find_by_name('Bug'), issue.tracker
55 55
    assert_equal IssuePriority.find_by_name('Low'), issue.priority
56 56
    assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
......
291 291
      # Check that the page shows the Estimated hours total
292 292
      assert page.has_css?('p.query-totals')
293 293
      assert page.has_css?('span.total-for-estimated-hours')
294
      # Open the Options of the form (necessary for having the totalable columns options clickable) 
294
      # Open the Options of the form (necessary for having the totalable columns options clickable)
295 295
      page.all('legend')[1].click
296
      # Deselect the default totalable column (none should be left) 
296
      # Deselect the default totalable column (none should be left)
297 297
      page.first('input[name="t[]"][value="estimated_hours"]').click
298 298
      within('#query_form') do
299 299
        click_link 'Apply'
test/system/sudo_mode_test.rb
35 35
  def test_add_user
36 36
    log_user('admin', 'admin')
37 37
    expire_sudo_mode!
38
    
38

  
39 39
    visit '/users/new'
40 40

  
41 41
    assert_difference 'User.count' do
test/unit/lib/redmine/ciphering_test.rb
64 64
      assert_equal 'clear', r.password
65 65
    end
66 66
  end
67
  
67

  
68 68
  def test_ciphered_password_with_no_cipher_key_configured_should_be_returned_ciphered
69 69
    Redmine::Configuration.with 'database_cipher_key' => 'secret' do
70 70
      r = Repository::Subversion.create!(:password => 'clear', :url => 'file:///tmp', :identifier => 'svn')
test/unit/lib/redmine/field_format/version_field_format_test.rb
73 73

  
74 74
    assert_equal expected, field.possible_values_options(project).map(&:first)
75 75
  end
76
 
76

  
77 77
  def test_possible_values_options_should_return_system_shared_versions_without_project
78 78
    field = IssueCustomField.new(:field_format => 'version')
79 79
    version = Version.generate!(:project => Project.find(1), :status => 'open', :sharing => 'system')
test/unit/lib/redmine/i18n_test.rb
70 70
        end
71 71
        assert l('date.day_names').is_a?(Array)
72 72
        assert_equal 7, l('date.day_names').size
73
  
73

  
74 74
        assert l('date.month_names').is_a?(Array)
75 75
        assert_equal 13, l('date.month_names').size
76 76
      end
test/unit/lib/redmine/menu_manager/menu_helper_test.rb
211 211
      end
212 212
    end
213 213
  end
214
 
214

  
215 215
  def test_render_empty_virtual_menu_node_with_children
216 216

  
217 217
    # only empty item with no click target
test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
77 77
      end
78 78
      assert_equal 8, brs.length
79 79
      br_issue_8857 = brs[0]
80
      assert_equal 'issue-8857', br_issue_8857.to_s 
80
      assert_equal 'issue-8857', br_issue_8857.to_s
81 81
      assert_equal '2a682156a3b6e77a8bf9cd4590e8db757f3c6c78', br_issue_8857.revision
82 82
      assert_equal br_issue_8857.scmid, br_issue_8857.revision
83 83
      assert_equal false, br_issue_8857.is_default
84 84
      br_latin_1_branch1 = brs[1]
85
      assert_equal "latin-1-branch-#{@char_1}-01", br_latin_1_branch1.to_s 
85
      assert_equal "latin-1-branch-#{@char_1}-01", br_latin_1_branch1.to_s
86 86
      assert_equal '4fc55c43bf3d3dc2efb66145365ddc17639ce81e', br_latin_1_branch1.revision
87 87
      assert_equal br_latin_1_branch1.scmid, br_latin_1_branch1.revision
88 88
      assert_equal false, br_latin_1_branch1.is_default
89 89
      br_latin_1_branch2 = brs[2]
90
      assert_equal "latin-1-branch-#{@char_1}-02", br_latin_1_branch2.to_s 
90
      assert_equal "latin-1-branch-#{@char_1}-02", br_latin_1_branch2.to_s
91 91
      assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', br_latin_1_branch2.revision
92 92
      assert_equal br_latin_1_branch2.scmid, br_latin_1_branch2.revision
93 93
      assert_equal false, br_latin_1_branch2.is_default
94 94
      br_latin_1_path = brs[3]
95
      assert_equal 'latin-1-path-encoding', br_latin_1_path.to_s 
95
      assert_equal 'latin-1-path-encoding', br_latin_1_path.to_s
96 96
      assert_equal '1ca7f5ed374f3cb31a93ae5215c2e25cc6ec5127', br_latin_1_path.revision
97 97
      assert_equal br_latin_1_path.scmid, br_latin_1_path.revision
98 98
      assert_equal false, br_latin_1_path.is_default
test/unit/lib/redmine/unified_diff_test.rb
123 123
--- file.c
124 124
-------------------------
125 125
+A line that starts with dashes:
126
 
126

  
127 127
 and removed.
128
 
128

  
129 129
@@ -23,4 +19,4 @@
130
 
131
 
132
 
130

  
131

  
132

  
133 133
-Another chunk of change
134 134
+Another chunk of changes
135 135

  
......
360 360
  end
361 361

  
362 362
  def test_offset_range_japanese_4
363
    # UTF-8 The 2nd byte differs. 
363
    # UTF-8 The 2nd byte differs.
364 364
    with_settings :repositories_encodings => '' do
365 365
      diff = Redmine::UnifiedDiff.new(
366 366
               read_diff_fixture('issue-13644-4.diff'), :type => 'sbs')
......
372 372
  end
373 373

  
374 374
  def test_offset_range_japanese_5
375
    # UTF-8 The 2nd byte differs. 
375
    # UTF-8 The 2nd byte differs.
376 376
    with_settings :repositories_encodings => '' do
377 377
      diff = Redmine::UnifiedDiff.new(
378 378
               read_diff_fixture('issue-13644-5.diff'), :type => 'sbs')
test/unit/lib/redmine/wiki_formatting/macros_test.rb
89 89

  
90 90
  def test_multiple_macros_on_the_same_line
91 91
    Redmine::WikiFormatting::Macros.macro :foo do |obj, args|
92
      args.any? ? "args: #{args.join(',')}" : "no args" 
92
      args.any? ? "args: #{args.join(',')}" : "no args"
93 93
    end
94 94

  
95 95
    assert_equal '<p>no args no args</p>', textilizable("{{foo}} {{foo}}")
......
212 212
    text = "{{collapse\n*Collapsed* block of text\n}}"
213 213
    with_locale 'en' do
214 214
      result = textilizable(text)
215
  
215

  
216 216
      assert_select_in result, 'div.collapsed-text'
217 217
      assert_select_in result, 'strong', :text => 'Collapsed'
218 218
      assert_select_in result, 'a.collapsible.collapsed', :text => 'Show'
......
249 249
h1. Title
250 250

  
251 251
{{collapse(Show example, Hide example)
252
h2. Heading 
252
h2. Heading
253 253
}}"
254 254
RAW
255 255

  
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
281 281
This is a table with trailing whitespace in one row:
282 282

  
283 283
|cell11|cell12|
284
|cell21|cell22| 
284
|cell21|cell22|
285 285
|cell31|cell32|
286 286
RAW
287 287

  
......
383 383
    expected = '<p><img src="/images/comment.png&quot;onclick=&amp;#x61;&amp;#x6c;&amp;#x65;&amp;#x72;&amp;#x74;&amp;#x28;&amp;#x27;&amp;#x58;&amp;#x53;&amp;#x53;&amp;#x27;&amp;#x29;;&amp;#x22;" alt="" /></p>'
384 384
    assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
385 385
  end
386
  
387
  
386

  
387

  
388 388
  STR_WITHOUT_PRE = [
389 389
  # 0
390 390
"h1. Title
......
414 414
Ut rhoncus elementum adipiscing."]
415 415

  
416 416
  TEXT_WITHOUT_PRE = STR_WITHOUT_PRE.join("\n\n").freeze
417
  
417

  
418 418
  def test_get_section_should_return_the_requested_section_and_its_hash
419 419
    assert_section_with_hash STR_WITHOUT_PRE[1], TEXT_WITHOUT_PRE, 2
420 420
    assert_section_with_hash STR_WITHOUT_PRE[2..3].join("\n\n"), TEXT_WITHOUT_PRE, 3
421 421
    assert_section_with_hash STR_WITHOUT_PRE[3], TEXT_WITHOUT_PRE, 5
422 422
    assert_section_with_hash STR_WITHOUT_PRE[4], TEXT_WITHOUT_PRE, 6
423
    
423

  
424 424
    assert_section_with_hash '', TEXT_WITHOUT_PRE, 0
425 425
    assert_section_with_hash '', TEXT_WITHOUT_PRE, 10
426 426
  end
427
  
427

  
428 428
  def test_update_section_should_update_the_requested_section
429 429
    replacement = "New text"
430
    
430

  
431 431
    assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement)
432 432
    assert_equal [STR_WITHOUT_PRE[0..1], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(3, replacement)
433 433
    assert_equal [STR_WITHOUT_PRE[0..2], replacement, STR_WITHOUT_PRE[4]].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(5, replacement)
434 434
    assert_equal [STR_WITHOUT_PRE[0..3], replacement].flatten.join("\n\n"), @formatter.new(TEXT_WITHOUT_PRE).update_section(6, replacement)
435
    
435

  
436 436
    assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(0, replacement)
437 437
    assert_equal TEXT_WITHOUT_PRE, @formatter.new(TEXT_WITHOUT_PRE).update_section(10, replacement)
438 438
  end
439
  
439

  
440 440
  def test_update_section_with_hash_should_update_the_requested_section
441 441
    replacement = "New text"
442
    
442

  
443 443
    assert_equal [STR_WITHOUT_PRE[0], replacement, STR_WITHOUT_PRE[2..4]].flatten.join("\n\n"),
444 444
      @formatter.new(TEXT_WITHOUT_PRE).update_section(2, replacement, Digest::MD5.hexdigest(STR_WITHOUT_PRE[1]))
445 445
  end
446
  
446

  
447 447
  def test_update_section_with_wrong_hash_should_raise_an_error
448 448
    assert_raise Redmine::WikiFormatting::StaleSectionError do
449 449
      @formatter.new(TEXT_WITHOUT_PRE).update_section(2, "New text", Digest::MD5.hexdigest("Old text"))
......
494 494
  def test_update_section_should_not_escape_pre_content_outside_section
495 495
    text = STR_WITH_PRE.join("\n\n")
496 496
    replacement = "New text"
497
    
497

  
498 498
    assert_equal [STR_WITH_PRE[0..1], "New text"].flatten.join("\n\n"),
499 499
      @formatter.new(text).update_section(3, replacement)
500 500
  end
......
509 509
h1. Heading 2
510 510

  
511 511
Content 2
512
 
512

  
513 513
h1. Heading 3
514 514

  
515 515
Content 3
516 516

  
517 517
h1. Heading 4
518
 
518

  
519 519
Content 4
520 520
STR
521 521

  
......
633 633
  def to_html(text)
634 634
    @formatter.new(text).to_html
635 635
  end
636
  
636

  
637 637
  def assert_section_with_hash(expected, text, index)
638 638
    result = @formatter.new(text).get_section(index)
639
    
639

  
640 640
    assert_kind_of Array, result
641 641
    assert_equal 2, result.size
642 642
    assert_equal expected, result.first, "section content did not match"
(5-5/5)