Removed unused let blocks (#7446)

The bodies of these blocks were never evaluated.
This commit is contained in:
Daniel Waterworth 2019-04-29 07:08:56 +00:00 committed by Guo Xiang Tan
parent 17b34f5744
commit ad44243a57
34 changed files with 0 additions and 74 deletions

View File

@ -8,8 +8,6 @@ describe FilterBestPosts do
let(:coding_horror) { Fabricate(:coding_horror) }
let(:first_poster) { topic.user }
let(:topic_view) { TopicView.new(topic.id, coding_horror) }
let!(:p1) { Fabricate(:post, topic: topic, user: first_poster, percent_rank: 1) }
let!(:p2) { Fabricate(:post, topic: topic, user: coding_horror, percent_rank: 0.5) }
let!(:p3) { Fabricate(:post, topic: topic, user: first_poster, percent_rank: 0) }

View File

@ -1181,8 +1181,6 @@ describe Guardian do
end
context 'as a moderator' do
let(:other_post) { Fabricate(:post, topic: topic, user: topic.user) }
before do
topic.save!
post.save!

View File

@ -21,7 +21,6 @@ describe PinnedCheck do
context "with a topic_user record" do
let(:user) { Fabricate.build(:user) }
let(:unpinned_topic_user) { Fabricate.build(:topic_user, user: user, topic: unpinned_topic) }
describe "unpinned topic" do
let(:topic_user) { TopicUser.new(topic: unpinned_topic, user: user) }

View File

@ -16,7 +16,6 @@ describe PrettyText do
end
let(:wrapped_image) { "<div class=\"lightbox-wrapper\"><a href=\"//localhost:3000/uploads/default/4399/33691397e78b4d75.png\" class=\"lightbox\" title=\"Screen Shot 2014-04-14 at 9.47.10 PM.png\"><img src=\"//localhost:3000/uploads/default/_optimized/bd9/b20/bbbcd6a0c0_655x500.png\" width=\"655\" height=\"500\"><div class=\"meta\">\n<span class=\"filename\">Screen Shot 2014-04-14 at 9.47.10 PM.png</span><span class=\"informations\">966x737 1.47 MB</span><span class=\"expand\"></span>\n</div></a></div>" }
let(:wrapped_image_excerpt) {}
describe "Quoting" do

View File

@ -6,7 +6,6 @@ require "file_store/s3_store"
describe "S3Inventory" do
let(:client) { Aws::S3::Client.new(stub_responses: true) }
let(:helper) { S3Helper.new(SiteSetting.Upload.s3_upload_bucket.downcase, "", client: client) }
let(:store) { FileStore::S3Store.new(helper) }
let(:inventory) { S3Inventory.new(helper, :upload) }
let(:csv_filename) { "#{Rails.root}/spec/fixtures/csv/s3_inventory.csv" }

View File

@ -233,9 +233,6 @@ describe SiteSettings::TypeSupervisor do
end
describe '#to_rb_value' do
let(:true_val) { 't' }
let(:false_val) { 'f' }
it 'the type can be overriden by a parameter' do
expect(settings.type_supervisor.to_rb_value(:type_null, '1', SiteSetting.types[:integer])).to eq(1)
end

View File

@ -525,8 +525,6 @@ describe TopicQuery do
end
context 'preload api' do
let(:topics) {}
it "preloads data correctly" do
TopicList.preloaded_custom_fields << "tag"
TopicList.preloaded_custom_fields << "age"

View File

@ -1,11 +1,6 @@
require 'rails_helper'
describe EmailValidator do
let(:record) {}
let(:validator) { described_class.new(attributes: :email) }
subject(:validate) { validator.validate_each(record, :email, record.email) }
def blocks?(email)
user = Fabricate.build(:user, email: email)
validator = EmailValidator.new(attributes: :email)

View File

@ -289,7 +289,6 @@ describe "category tag restrictions" do
end
describe "tag topic counts per category" do
let(:user) { Fabricate(:user) }
let(:admin) { Fabricate(:admin) }
let(:category) { Fabricate(:category) }
let(:category2) { Fabricate(:category) }

View File

@ -8,7 +8,6 @@ describe Jobs::BulkInvite do
let!(:group2) { Fabricate(:group, name: 'group2') }
let!(:topic) { Fabricate(:topic, id: 999) }
let(:email) { "test@discourse.org" }
let(:csv_info) { [] }
let(:basename) { "bulk_invite.csv" }
let(:filename) { "#{Invite.base_directory}/#{basename}" }

View File

@ -8,8 +8,6 @@ describe Jobs::CleanUpUploads do
Fabricate(:upload, { created_at: 2.hours.ago }.merge(attributes))
end
let(:upload) { fabricate_upload }
before do
SiteSetting.clean_up_uploads = true
SiteSetting.clean_orphan_uploads_grace_period_hours = 1

View File

@ -74,7 +74,6 @@ describe Jobs::EnqueueDigestEmails do
context 'visited the site this week' do
let(:user_visited_this_week) { Fabricate(:active_user, last_seen_at: 6.days.ago) }
let(:user_visited_this_week_email_always) { Fabricate(:active_user, last_seen_at: 6.days.ago, email_level: UserOption.email_level_types[:always]) }
it "doesn't return users who have been emailed recently" do
user = user_visited_this_week

View File

@ -6,7 +6,6 @@ describe Jobs::PollFeed do
context "execute" do
let(:url) { "http://eviltrout.com" }
let(:embed_by_username) { "eviltrout" }
before do
$redis.del("feed-polled-recently")

View File

@ -24,8 +24,6 @@ describe Jobs::PollMailbox do
describe ".poll_pop3" do
context "pop errors" do
let(:user) { Fabricate(:user) }
before do
Discourse.expects(:handle_job_exception).at_least_once
end

View File

@ -403,7 +403,6 @@ describe Post do
context "with a previous host" do
let(:user) { old_post.newuser }
let(:another_disney_link) { post_with_body("[radiator springs](http://disneyland.disney.go.com/disney-california-adventure/radiator-springs-racers/)", newuser) }
before do

View File

@ -7,7 +7,6 @@ RSpec.describe Reviewable, type: :model do
let(:user) { Fabricate(:user) }
let(:reviewable) { Fabricate.build(:reviewable, created_by: admin) }
let(:queued_post) { Fabricate.build(:reviewable_queued_post) }
it "can create a reviewable object" do
expect(reviewable).to be_present

View File

@ -83,11 +83,6 @@ describe TagUser do
create_post(tags: [watched_tag.name])
end
let :muted_post do
TagUser.create!(user: user, tag: muted_tag, notification_level: TagUser.notification_levels[:muted])
create_post(tags: [muted_tag.name])
end
let :tracked_post do
TagUser.create!(user: user, tag: tracked_tag, notification_level: TagUser.notification_levels[:tracking])
create_post(tags: [tracked_tag.name])

View File

@ -737,7 +737,6 @@ describe Topic do
context 'invite' do
context 'existing user' do
let(:walter) { Fabricate(:walter_white) }
context 'by group name' do
let(:group) { Fabricate(:group) }

View File

@ -83,7 +83,6 @@ describe TopicUser do
let(:topic_user) { TopicUser.get(topic, user) }
let(:topic_creator_user) { TopicUser.get(topic, topic.user) }
let(:post) { Fabricate(:post, topic: topic, user: user) }
let(:new_user) {
u = Fabricate(:user)
u.user_option.update_columns(auto_track_topics_after_msecs: 1000)

View File

@ -3,28 +3,20 @@ require 'rails_helper'
describe Upload do
let(:upload) { build(:upload) }
let(:thumbnail) { build(:optimized_image, upload: upload) }
let(:user_id) { 1 }
let(:url) { "http://domain.com" }
let(:image_filename) { "logo.png" }
let(:image) { file_from_fixtures(image_filename) }
let(:image_filesize) { File.size(image) }
let(:image_sha1) { Upload.generate_digest(image) }
let(:image_svg_filename) { "image.svg" }
let(:image_svg) { file_from_fixtures(image_svg_filename) }
let(:image_svg_filesize) { File.size(image_svg) }
let(:huge_image_filename) { "huge.jpg" }
let(:huge_image) { file_from_fixtures(huge_image_filename) }
let(:huge_image_filesize) { File.size(huge_image) }
let(:attachment_path) { __FILE__ }
let(:attachment) { File.new(attachment_path) }
let(:attachment_filename) { File.basename(attachment_path) }
let(:attachment_filesize) { File.size(attachment_path) }
context ".create_thumbnail!" do
@ -202,8 +194,6 @@ describe Upload do
end
describe 'when upload bucket contains subfolder' do
let(:url) { "#{SiteSetting.Upload.absolute_base_url}/path/path2#{path}" }
before do
SiteSetting.s3_upload_bucket = "s3-upload-bucket/path/path2"
end

View File

@ -1,8 +1,6 @@
require 'rails_helper'
RSpec.describe "Running Sidekiq Jobs in Multisite", type: :multisite do
let(:conn) { RailsMultisite::ConnectionManagement }
it 'should revert back to the default connection' do
expect do
Jobs::DestroyOldDeletionStubs.new.perform({})

View File

@ -4,7 +4,6 @@ RSpec.describe Admin::BackupsController do
let(:admin) { Fabricate(:admin) }
let(:backup_filename) { "2014-02-10-065935.tar.gz" }
let(:backup_filename2) { "2014-02-11-065935.tar.gz" }
let(:store) { BackupRestore::LocalBackupStore.new }
def create_backup_files(*filenames)
@paths = filenames.map do |filename|

View File

@ -251,8 +251,6 @@ describe CategoriesController do
end
describe "logged in" do
let(:valid_attrs) { { id: category.id, name: "hello", color: "ff0", text_color: "fff" } }
before do
sign_in(admin)
end
@ -399,8 +397,6 @@ describe CategoriesController do
end
describe 'logged in' do
let(:valid_attrs) { { id: category.id, slug: 'fff' } }
before do
sign_in(admin)
end

View File

@ -2,7 +2,6 @@ require 'rails_helper'
describe EmbedController do
let(:host) { "eviltrout.com" }
let(:embed_url) { "http://eviltrout.com/2013/02/10/why-discourse-uses-emberjs.html" }
let(:embed_url_secure) { "https://eviltrout.com/2013/02/10/why-discourse-uses-emberjs.html" }
let(:discourse_username) { "eviltrout" }

View File

@ -1,8 +1,6 @@
require "rails_helper"
describe ExportCsvController do
let(:export_filename) { "user-archive-codinghorror-150115-234817-999.csv.gz" }
context "while logged in as normal user" do
let(:user) { Fabricate(:user) }
before { sign_in(user) }

View File

@ -4,7 +4,6 @@ RSpec.describe ListController do
let(:topic) { Fabricate(:topic, user: user) }
let(:group) { Fabricate(:group) }
let(:user) { Fabricate(:user) }
let(:post) { Fabricate(:post, user: user) }
let(:admin) { Fabricate(:admin) }
before do
@ -200,8 +199,6 @@ RSpec.describe ListController do
)
end
let(:private_post) { Fabricate(:post, topic: topic) }
it 'should return the right response' do
get "/topics/private-messages-group/#{user.username}/#{group.name}.json"

View File

@ -277,7 +277,6 @@ describe PostsController do
describe 'when logged in' do
let(:user) { Fabricate(:user) }
let(:post) { Fabricate(:post, user: user, post_number: 2) }
it "raises an error when the user doesn't have permission to see the post" do
post = Fabricate(:post, topic: Fabricate(:private_message_topic), post_number: 3)

View File

@ -1145,7 +1145,6 @@ RSpec.describe SessionController do
end
context 'when admins are restricted by ip address' do
let(:permitted_ip_address) { '111.234.23.11' }
before do
SiteSetting.use_admin_ip_whitelist = true
ScreenedIpAddress.all.destroy_all

View File

@ -336,7 +336,6 @@ RSpec.describe TopicsController do
let(:trust_level_4) { Fabricate(:trust_level_4) }
let(:evil_trout) { Fabricate(:evil_trout) }
let(:message) { Fabricate(:private_message_topic) }
let(:p1) { Fabricate(:post, user: user, post_number: 1, topic: message) }
let(:p2) { Fabricate(:post, user: evil_trout, post_number: 2, topic: message) }
let(:dest_message) do
@ -2580,7 +2579,6 @@ RSpec.describe TopicsController do
describe 'shared drafts' do
let(:shared_drafts_category) { Fabricate(:category) }
let(:category) { Fabricate(:category) }
before do
SiteSetting.shared_drafts_category = shared_drafts_category.id
@ -2629,7 +2627,6 @@ RSpec.describe TopicsController do
let(:category) { Fabricate(:category) }
let(:topic) { Fabricate(:topic, category: shared_drafts_category, visible: false) }
let!(:post) { Fabricate(:post, topic: topic) }
let(:shared_draft) { Fabricate(:shared_draft, topic: topic, category: category) }
let(:moderator) { Fabricate(:moderator) }
it "fails for anonymous users" do

View File

@ -832,8 +832,6 @@ describe UsersController do
end
context 'authentication records for' do
let(:user) { Fabricate(:user) }
before do
OmniAuth.config.test_mode = true
@ -2574,7 +2572,6 @@ describe UsersController do
describe '#show' do
context "anon" do
let(:user) { Discourse.system_user }
let(:other_user) { Fabricate(:user) }
it "returns success" do
get "/u/#{user.username}.json"

View File

@ -31,12 +31,6 @@ describe BasicGroupSerializer do
end
describe 'group owner' do
let(:user) do
user = Fabricate(:user)
group.add_owner(user)
user
end
it 'should include bio_raw' do
expect(subject.as_json[:bio_raw]).to eq('testing')
end

View File

@ -3,7 +3,6 @@ require 'rails_helper'
describe TopicTimestampChanger do
describe "change!" do
let(:old_timestamp) { Time.zone.now }
let(:new_timestamp) { old_timestamp + 1.day }
let(:topic) { Fabricate(:topic, created_at: old_timestamp) }
let!(:p1) { Fabricate(:post, topic: topic, created_at: old_timestamp) }
let!(:p2) { Fabricate(:post, topic: topic, created_at: old_timestamp + 1.day) }

View File

@ -19,7 +19,6 @@ end
describe UserAuthenticator do
context "#finish" do
let(:authenticator) { Auth::GithubAuthenticator.new }
let(:group) { Fabricate(:group, automatic_membership_email_domains: "discourse.org") }
before do

View File

@ -677,7 +677,6 @@ describe UserMerger do
let(:post1) { Fabricate(:post) }
let(:post2) { Fabricate(:post) }
let(:post3) { Fabricate(:post) }
def log_like_action(acting_user, user, post)
UserAction.log_action!(action_type: UserAction::LIKE,