Add rubocop to our build. (#5004)

This commit is contained in:
Guo Xiang Tan
2017-07-28 10:20:09 +09:00
committed by GitHub
parent ff4e295c4f
commit 5012d46cbd
871 changed files with 5480 additions and 6056 deletions

View File

@ -7,7 +7,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
let(:topic) do
Fabricate(:private_message_topic, first_post: first_post,
topic_allowed_users: [
topic_allowed_users: [
Fabricate.build(:topic_allowed_user, user: discobot_user),
Fabricate.build(:topic_allowed_user, user: user),
]
@ -79,15 +79,13 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
new_post = Post.offset(1).last
expect(narrative.get_data(user)).to eq({
"topic_id" => topic.id,
"state" => "tutorial_edit",
"last_post_id" => new_post.id,
"track" => described_class.to_s,
"tutorial_edit" => {
expect(narrative.get_data(user)).to eq("topic_id" => topic.id,
"state" => "tutorial_edit",
"last_post_id" => new_post.id,
"track" => described_class.to_s,
"tutorial_edit" => {
"post_id" => Post.last.id
}
})
})
expect(new_post.raw).to eq(expected_raw.chomp)
expect(new_post.topic.id).to eq(topic.id)
@ -111,15 +109,13 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
new_post = Post.offset(1).last
expect(narrative.get_data(user)).to eq({
"topic_id" => new_post.topic.id,
"state" => "tutorial_edit",
"last_post_id" => new_post.id,
"track" => described_class.to_s,
"tutorial_edit" => {
expect(narrative.get_data(user)).to eq("topic_id" => new_post.topic.id,
"state" => "tutorial_edit",
"last_post_id" => new_post.id,
"track" => described_class.to_s,
"tutorial_edit" => {
"post_id" => Post.last.id
}
})
})
expect(new_post.raw).to eq(expected_raw.chomp)
expect(new_post.topic.id).to_not eq(topic.id)
@ -659,11 +655,9 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
'discourse_narrative_bot.advanced_user_narrative.details.reply', base_uri: ''
))
expect(narrative.get_data(user)).to eq({
"state" => "end",
"topic_id" => topic.id,
"track" => described_class.to_s
})
expect(narrative.get_data(user)).to eq("state" => "end",
"topic_id" => topic.id,
"track" => described_class.to_s)
expect(user.badges.where(name: DiscourseNarrativeBot::AdvancedUserNarrative::BADGE_NAME).exists?)
.to eq(true)

View File

@ -8,7 +8,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
let(:topic) do
Fabricate(:private_message_topic, first_post: first_post,
topic_allowed_users: [
topic_allowed_users: [
Fabricate.build(:topic_allowed_user, user: discobot_user),
Fabricate.build(:topic_allowed_user, user: user),
]
@ -83,12 +83,10 @@ describe DiscourseNarrativeBot::NewUserNarrative do
new_post = Post.last
expect(narrative.get_data(user)).to eq({
"topic_id" => topic.id,
"state" => "tutorial_bookmark",
"last_post_id" => new_post.id,
"track" => described_class.to_s
})
expect(narrative.get_data(user)).to eq("topic_id" => topic.id,
"state" => "tutorial_bookmark",
"last_post_id" => new_post.id,
"track" => described_class.to_s)
expect(new_post.raw).to eq(expected_raw.chomp)
expect(new_post.topic.id).to eq(topic.id)
@ -111,12 +109,10 @@ describe DiscourseNarrativeBot::NewUserNarrative do
new_post = Post.last
expect(narrative.get_data(user)).to eq({
"topic_id" => new_post.topic.id,
"state" => "tutorial_bookmark",
"last_post_id" => new_post.id,
"track" => described_class.to_s
})
expect(narrative.get_data(user)).to eq("topic_id" => new_post.topic.id,
"state" => "tutorial_bookmark",
"last_post_id" => new_post.id,
"track" => described_class.to_s)
expect(new_post.raw).to eq(expected_raw.chomp)
expect(new_post.topic.id).to_not eq(topic.id)
@ -922,11 +918,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do
expect(first_post.reload.raw).to eq('Hello world')
expect(narrative.get_data(user)).to include({
"state" => "end",
"topic_id" => new_post.topic_id,
"track" => described_class.to_s,
})
expect(narrative.get_data(user)).to include("state" => "end",
"topic_id" => new_post.topic_id,
"track" => described_class.to_s)
expect(user.badges.where(name: DiscourseNarrativeBot::NewUserNarrative::BADGE_NAME).exists?)
.to eq(true)

View File

@ -42,7 +42,7 @@ describe DiscourseNarrativeBot::TrackSelector do
let(:topic) do
Fabricate(:private_message_topic, first_post: first_post,
topic_allowed_users: [
topic_allowed_users: [
Fabricate.build(:topic_allowed_user, user: discobot_user),
Fabricate.build(:topic_allowed_user, user: user),
]
@ -454,7 +454,6 @@ describe DiscourseNarrativeBot::TrackSelector do
expect(new_post.raw).to eq(random_mention_reply)
end
describe 'rate limiting random reply message in public topic' do
let(:topic) { Fabricate(:topic) }
let(:other_post) { Fabricate(:post, raw: '@discobot show me something', topic: topic) }