mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
Add rubocop to our build. (#5004)
This commit is contained in:
@ -53,7 +53,7 @@ describe TopicsController do
|
||||
it "cookie can fail back to user if out of sync" do
|
||||
user = log_in
|
||||
user.user_option.update_columns(theme_key: theme.key)
|
||||
cookies['theme_key'] = "#{theme2.key},#{user.user_option.theme_key_seq-1}"
|
||||
cookies['theme_key'] = "#{theme2.key},#{user.user_option.theme_key_seq - 1}"
|
||||
|
||||
get :show, id: 666
|
||||
expect(controller.theme_key).to eq(theme.key)
|
||||
@ -68,7 +68,7 @@ describe TopicsController do
|
||||
|
||||
it "doesn't raise an error on a very long link" do
|
||||
set_referer("http://#{'a' * 2000}.com")
|
||||
expect { get :show, {id: topic.id} }.not_to raise_error
|
||||
expect { get :show, id: topic.id }.not_to raise_error
|
||||
end
|
||||
|
||||
describe "has_escaped_fragment?" do
|
||||
@ -78,7 +78,7 @@ describe TopicsController do
|
||||
|
||||
it "uses the application layout even with an escaped fragment param" do
|
||||
SiteSetting.enable_escaped_fragments = false
|
||||
get :show, {'topic_id' => topic.id, 'slug' => topic.slug, '_escaped_fragment_' => 'true'}
|
||||
get :show, 'topic_id' => topic.id, 'slug' => topic.slug, '_escaped_fragment_' => 'true'
|
||||
expect(response).to render_template(layout: 'application')
|
||||
assert_select "meta[name=fragment]", false, "it doesn't have the meta tag"
|
||||
end
|
||||
@ -151,7 +151,7 @@ describe TopicsController do
|
||||
|
||||
request.cookies['cn'] = "2828,100,#{notification.id}"
|
||||
|
||||
get :show, {topic_id: 100}
|
||||
get :show, topic_id: 100
|
||||
|
||||
expect(response.cookies['cn']).to eq nil
|
||||
|
||||
@ -166,7 +166,7 @@ describe TopicsController do
|
||||
|
||||
request.headers['Discourse-Clear-Notifications'] = "2828,100,#{notification.id}"
|
||||
|
||||
get :show, {topic_id: 100}
|
||||
get :show, topic_id: 100
|
||||
|
||||
notification.reload
|
||||
expect(notification.read).to eq true
|
||||
@ -184,7 +184,7 @@ describe TopicsController do
|
||||
|
||||
context "with an anonymous user" do
|
||||
it "uses the default locale" do
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
|
||||
expect(I18n.locale).to eq(:en)
|
||||
end
|
||||
@ -195,7 +195,7 @@ describe TopicsController do
|
||||
user = Fabricate(:user, locale: :fr)
|
||||
log_in_user(user)
|
||||
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
|
||||
expect(I18n.locale).to eq(:en)
|
||||
end
|
||||
@ -214,7 +214,7 @@ describe TopicsController do
|
||||
|
||||
context "with an anonymous user" do
|
||||
it "uses the locale from the headers" do
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
|
||||
expect(I18n.locale).to eq(:fr)
|
||||
end
|
||||
@ -225,7 +225,7 @@ describe TopicsController do
|
||||
user = Fabricate(:user, locale: :fr)
|
||||
log_in_user(user)
|
||||
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
|
||||
expect(I18n.locale).to eq(:fr)
|
||||
end
|
||||
@ -239,7 +239,7 @@ describe TopicsController do
|
||||
SiteSetting.default_locale = "en"
|
||||
set_accept_language("zh-CN")
|
||||
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
|
||||
expect(I18n.locale).to eq(:zh_CN)
|
||||
end
|
||||
@ -251,7 +251,7 @@ describe TopicsController do
|
||||
SiteSetting.default_locale = 'en'
|
||||
set_accept_language('')
|
||||
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
|
||||
expect(I18n.locale).to eq(:en)
|
||||
end
|
||||
@ -261,13 +261,13 @@ describe TopicsController do
|
||||
|
||||
describe "read only header" do
|
||||
it "returns no read only header by default" do
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
expect(response.headers['Discourse-Readonly']).to eq(nil)
|
||||
end
|
||||
|
||||
it "returns a readonly header if the site is read only" do
|
||||
Discourse.received_readonly!
|
||||
get :show, {topic_id: topic.id}
|
||||
get :show, topic_id: topic.id
|
||||
expect(response.headers['Discourse-Readonly']).to eq('true')
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user