X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5b33f3f8e31c62bc3e5db1d5b120533c3afdde68..c77c7d015f224db8c383932c3745e1cbd48eb519:/test/helpers/application_helper_test.rb diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 720113e65..d1c41d62c 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1,6 +1,8 @@ require "test_helper" class ApplicationHelperTest < ActionView::TestCase + attr_accessor :current_user + def setup I18n.locale = "en" end @@ -46,7 +48,7 @@ class ApplicationHelperTest < ActionView::TestCase end def test_style_rules - @user = nil + self.current_user = nil css = style_rules assert_match /\.hidden /, css @@ -57,36 +59,36 @@ class ApplicationHelperTest < ActionView::TestCase assert_match /\.hide_unless_administrator /, css assert_match /\.hide_unless_moderator /, css - @user = create(:user) + self.current_user = create(:user) css = style_rules assert_match /\.hidden /, css assert_no_match /\.hide_unless_logged_in /, css assert_match /\.hide_if_logged_in /, css - assert_match /\.hide_if_user_#{@user.id} /, css - assert_match /\.show_if_user_#{@user.id} /, css + assert_match /\.hide_if_user_#{current_user.id} /, css + assert_match /\.show_if_user_#{current_user.id} /, css assert_match /\.hide_unless_administrator /, css assert_match /\.hide_unless_moderator /, css - @user = create(:moderator_user) + self.current_user = create(:moderator_user) css = style_rules assert_match /\.hidden /, css assert_no_match /\.hide_unless_logged_in /, css assert_match /\.hide_if_logged_in /, css - assert_match /\.hide_if_user_#{@user.id} /, css - assert_match /\.show_if_user_#{@user.id} /, css + assert_match /\.hide_if_user_#{current_user.id} /, css + assert_match /\.show_if_user_#{current_user.id} /, css assert_match /\.hide_unless_administrator /, css assert_no_match /\.hide_unless_moderator /, css - @user = create(:administrator_user) + self.current_user = create(:administrator_user) css = style_rules assert_match /\.hidden /, css assert_no_match /\.hide_unless_logged_in /, css assert_match /\.hide_if_logged_in /, css - assert_match /\.hide_if_user_#{@user.id} /, css - assert_match /\.show_if_user_#{@user.id} /, css + assert_match /\.hide_if_user_#{current_user.id} /, css + assert_match /\.show_if_user_#{current_user.id} /, css assert_no_match /\.hide_unless_administrator /, css assert_match /\.hide_unless_moderator /, css end