Skip to content

Commit 9866340

Browse files
committed
Test plus solide, et utilisation de double quote à certains endroits
1 parent 5422fe2 commit 9866340

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

app/controllers/trackers_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def index
2121
@tracker.state = @attrs["state"]
2222
@trackers = @trackers.where(state: @tracker.state) if @attrs["state"].present?
2323
@trackers = @trackers.where(category_id: @tracker.category_id) if @attrs["category_id"].present?
24-
if @attrs["assigned_to_user_id"] == '0'
24+
if @attrs["assigned_to_user_id"] == "0"
2525
@trackers = @trackers.where(assigned_to_user_id: nil)
2626
elsif @attrs["assigned_to_user_id"].present?
2727
@trackers = @trackers.where(assigned_to_user_id: @tracker.assigned_to_user_id)

app/helpers/admin_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module AdminHelper
22
def abusers
3-
file = Rails.root.join('tmp/abusers.txt')
3+
file = Rails.root.join("tmp/abusers.txt")
44
if File.exist?(file)
5-
content_tag(:ul, class: 'abusers') do
5+
content_tag(:ul, class: "abusers") do
66
File.readlines(file).map do |l|
77
content_tag(:li, l)
88
end.join.html_safe
99
end
1010
else
11-
content_tag(:p, 'aucun')
11+
content_tag(:p, "aucun")
1212
end
1313
end
1414
end

bin/update

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env ruby
2-
require 'fileutils'
2+
require "fileutils"
33
include FileUtils
44

55
# path to your application root.
6-
APP_ROOT = File.expand_path('..', __dir__)
6+
APP_ROOT = File.expand_path("..", __dir__)
77

88
def system!(*args)
99
system(*args) || abort("\n== Command #{args} failed ==")

db/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.0].define(version: 2023_10_01_132606) do
13+
ActiveRecord::Schema[7.1].define(version: 2023_10_01_132606) do
1414
create_table "accounts", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
1515
t.integer "user_id"
1616
t.string "login", limit: 40, null: false, collation: "utf8mb4_bin"

test/controllers/comments_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
44
include Devise::Test::IntegrationHelpers
55

66
setup do
7-
sign_in accounts "visitor_0"
7+
sign_in accounts "visitor_1"
88
end
99

1010
test "should list comments" do

test/controllers/relevances_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RelevancesControllerTest < ActionDispatch::IntegrationTest
3030
end
3131

3232
test "should not vote for" do
33-
sign_in accounts "visitor_10"
33+
sign_in accounts "visitor_1"
3434

3535
assert_no_difference "comments(:one).nb_votes_for" do
3636
post relevance_for_node_comment_url nodes(:tracker_one), comments(:one), format: :json
@@ -42,7 +42,7 @@ class RelevancesControllerTest < ActionDispatch::IntegrationTest
4242
end
4343

4444
test "should not vote against" do
45-
sign_in accounts "visitor_10"
45+
sign_in accounts "visitor_1"
4646

4747
assert_no_difference "comments(:one).nb_votes_against" do
4848
post relevance_against_node_comment_url nodes(:tracker_one), comments(:one), format: :json

test/fixtures/comments.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
one:
22
node: tracker_one
3-
user: visitor_10
3+
user: visitor_1
44
title: "Hello World"
55
wiki_body: "Hello World"
66
materialized_path: "hello-world"
77
state: published
88

99
seconde:
1010
node: one
11-
user: visitor_10
11+
user: visitor_1
1212
title: Commentaire sur un journal
1313
wiki_body: Commentaire sur un journal
1414

1515
old:
1616
node: old
17-
user: visitor_10
17+
user: visitor_1
1818
title: Commentaire sur un journal
1919
wiki_body: Commentaire sur un journal
2020
created_at: 2010-01-01 00:00:00
2121

2222
poll:
2323
node: poll
24-
user: visitor_10
24+
user: visitor_1
2525
title: Commentaire sur un sondage
2626
wiki_body: Commentaire sur un sondage
2727
created_at: 2010-01-01 00:00:00
2828
materialized_path: 000079493703
2929

3030
poll_2:
3131
node: poll
32-
user: visitor_10
32+
user: visitor_1
3333
title: Commentaire sur un sondage
3434
wiki_body: Commentaire sur un sondage
3535
created_at: 2010-01-01 00:00:00

test/test_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
add_group "Long files" do |src_file|
99
src_file.lines.count > 100
1010
end
11+
load_profile "test_frameworks"
1112
end
1213

1314
ENV["RAILS_ENV"] ||= "test"

0 commit comments

Comments
 (0)