mirror of
https://github.com/diaspora/diaspora.git
synced 2026-01-09 07:08:07 -05:00
Update factory_girl to factory_bot
This commit is contained in:
committed by
Jonne Haß
parent
e0af180c9b
commit
671e8476ba
2
Gemfile
2
Gemfile
@@ -288,7 +288,7 @@ group :test do
|
||||
|
||||
# General helpers
|
||||
|
||||
gem "factory_girl_rails", "4.9.0"
|
||||
gem "factory_bot_rails", "6.1.0"
|
||||
gem "shoulda-matchers", "4.0.1"
|
||||
gem "timecop", "0.9.1"
|
||||
gem "webmock", "3.8.3", require: false
|
||||
|
||||
12
Gemfile.lock
12
Gemfile.lock
@@ -227,11 +227,11 @@ GEM
|
||||
state_machines
|
||||
thor
|
||||
fabrication (2.21.0)
|
||||
factory_girl (4.9.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.9.0)
|
||||
factory_girl (~> 4.9.0)
|
||||
railties (>= 3.0.0)
|
||||
factory_bot (6.1.0)
|
||||
activesupport (>= 5.0.0)
|
||||
factory_bot_rails (6.1.0)
|
||||
factory_bot (~> 6.1.0)
|
||||
railties (>= 5.0.0)
|
||||
faraday (0.15.4)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-cookie_jar (0.0.6)
|
||||
@@ -811,7 +811,7 @@ DEPENDENCIES
|
||||
diaspora_federation-test (= 0.2.6)
|
||||
entypo-rails (= 3.0.0)
|
||||
eye (= 0.10.0)
|
||||
factory_girl_rails (= 4.9.0)
|
||||
factory_bot_rails (= 6.1.0)
|
||||
faraday (= 0.15.4)
|
||||
faraday-cookie_jar (= 0.0.6)
|
||||
faraday_middleware (= 0.13.1)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Then /^I should see the "(.*)" message$/ do |message|
|
||||
text = case message
|
||||
when "alice is excited"
|
||||
@alice ||= FactoryGirl.create(:user, :username => "Alice")
|
||||
@alice ||= FactoryBot.create(:user, :username => "Alice")
|
||||
I18n.translate('invitation_codes.excited', :name => @alice.name)
|
||||
when "welcome to diaspora"
|
||||
I18n.translate('users.getting_started.well_hello_there')
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Given /^a client with a provided picture exists for user "([^\"]*)"$/ do |email|
|
||||
app = FactoryGirl.create(:o_auth_application, logo_uri: "/assets/user/default.png")
|
||||
app = FactoryBot.create(:o_auth_application, logo_uri: "/assets/user/default.png")
|
||||
user = User.find_by(email: email)
|
||||
FactoryGirl.create(:auth_with_read_scopes, user: user, o_auth_application: app)
|
||||
FactoryBot.create(:auth_with_read_scopes, user: user, o_auth_application: app)
|
||||
end
|
||||
|
||||
Given /^a client exists for user "([^\"]*)"$/ do |email|
|
||||
user = User.find_by(email: email)
|
||||
FactoryGirl.create(:auth_with_read_scopes, user: user)
|
||||
FactoryBot.create(:auth_with_read_scopes, user: user)
|
||||
end
|
||||
|
||||
When /^I register a new client$/ do
|
||||
|
||||
@@ -20,19 +20,19 @@ end
|
||||
Given /^"([^"]*)" has a public post with text "([^"]*)" and a poll$/ do |email, text|
|
||||
user = User.find_by(email: email)
|
||||
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
|
||||
FactoryGirl.create(:poll, status_message: post)
|
||||
FactoryBot.create(:poll, status_message: post)
|
||||
end
|
||||
|
||||
Given /^"([^"]*)" has a public post with text "([^"]*)" and a location$/ do |email, text|
|
||||
user = User.find_by(email: email)
|
||||
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
|
||||
FactoryGirl.create(:location, status_message: post)
|
||||
FactoryBot.create(:location, status_message: post)
|
||||
end
|
||||
|
||||
Given /^"([^"]*)" has a public post with text "([^"]*)" and a picture/ do |email, text|
|
||||
user = User.find_by(email: email)
|
||||
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
|
||||
FactoryGirl.create(:photo, status_message: post)
|
||||
FactoryBot.create(:photo, status_message: post)
|
||||
end
|
||||
|
||||
Given /^there are (\d+) public posts from "([^"]*)"$/ do |n_posts, email|
|
||||
|
||||
@@ -11,5 +11,5 @@ When(/^I unfollow the "(.*?)" tag$/) do |tag|
|
||||
end
|
||||
|
||||
When /^I follow the "(.*?)" tag$/ do |tag|
|
||||
TagFollowing.create!(tag: FactoryGirl.create(:tag, name: tag), user: @me)
|
||||
TagFollowing.create!(tag: FactoryBot.create(:tag, name: tag), user: @me)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Given /^a user with username "([^\"]*)" and password "([^\"]*)"$/ do |username, password|
|
||||
@me ||= FactoryGirl.create(:user, :username => username, :password => password,
|
||||
@me ||= FactoryBot.create(:user, :username => username, :password => password,
|
||||
:password_confirmation => password, :getting_started => false)
|
||||
@me.aspects.create(:name => "Besties")
|
||||
@me.aspects.create(:name => "Unicorns")
|
||||
@@ -50,7 +50,7 @@ Given /^(?:|[tT]hat )?following user[s]?(?: exist[s]?)?:$/ do |table|
|
||||
end
|
||||
|
||||
Given /^I have been invited by an admin$/ do
|
||||
admin = FactoryGirl.create(:user)
|
||||
admin = FactoryBot.create(:user)
|
||||
admin.invitation_code
|
||||
i = EmailInviter.new("new_invitee@example.com", admin)
|
||||
i.send!
|
||||
@@ -107,8 +107,8 @@ Given /^a user with email "([^\"]*)" is tagged "([^\"]*)"$/ do |email, tags|
|
||||
end
|
||||
|
||||
Given /^many posts from alice for bob$/ do
|
||||
alice = FactoryGirl.create(:user_with_aspect, :username => 'alice', :email => 'alice@alice.alice', :password => 'password', :getting_started => false)
|
||||
bob = FactoryGirl.create(:user_with_aspect, :username => 'bob', :email => 'bob@bob.bob', :password => 'password', :getting_started => false)
|
||||
alice = FactoryBot.create(:user_with_aspect, :username => 'alice', :email => 'alice@alice.alice', :password => 'password', :getting_started => false)
|
||||
bob = FactoryBot.create(:user_with_aspect, :username => 'bob', :email => 'bob@bob.bob', :password => 'password', :getting_started => false)
|
||||
connect_users_with_aspects(alice, bob)
|
||||
time_fulcrum = Time.now - 40000
|
||||
time_interval = 1000
|
||||
@@ -171,7 +171,7 @@ end
|
||||
|
||||
When /^"([^\"]+)" has posted a (public )?status message with a photo$/ do |email, public_status|
|
||||
user = User.find_for_database_authentication(:username => email)
|
||||
post = FactoryGirl.create(
|
||||
post = FactoryBot.create(
|
||||
:status_message_with_photo,
|
||||
text: "Look at this dog",
|
||||
author: user.person,
|
||||
@@ -195,7 +195,7 @@ Given /^I have (\d+) contacts$/ do |n|
|
||||
aspect_memberships = []
|
||||
|
||||
count.times do
|
||||
person = FactoryGirl.create(:person)
|
||||
person = FactoryBot.create(:person)
|
||||
people << person
|
||||
end
|
||||
|
||||
@@ -233,5 +233,5 @@ Then /^I should get a zipped file$/ do
|
||||
end
|
||||
|
||||
And /^a person with ID "([^\"]*)" has been discovered$/ do |diaspora_id|
|
||||
FactoryGirl.create(:person, diaspora_handle: diaspora_id)
|
||||
FactoryBot.create(:person, diaspora_handle: diaspora_id)
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ module UserCukeHelpers
|
||||
:getting_started => false
|
||||
}
|
||||
|
||||
user = FactoryGirl.create(:user, default_attrs.merge(overrides))
|
||||
user = FactoryBot.create(:user, default_attrs.merge(overrides))
|
||||
add_standard_aspects(user)
|
||||
user
|
||||
end
|
||||
@@ -33,7 +33,7 @@ module UserCukeHelpers
|
||||
# create a new @me user, if not present, and log in using the
|
||||
# integration_sessions controller (automatic)
|
||||
def automatic_login
|
||||
@me ||= FactoryGirl.create(:user_with_aspect, :getting_started => false)
|
||||
@me ||= FactoryBot.create(:user_with_aspect, :getting_started => false)
|
||||
visit(new_integration_sessions_path(user_id: @me.id))
|
||||
click_button "Login"
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
describe Admin::PodsController, type: :controller do
|
||||
before do
|
||||
@user = FactoryGirl.create :user
|
||||
@user = FactoryBot.create :user
|
||||
Role.add_admin(@user.person)
|
||||
|
||||
sign_in @user, scope: :user
|
||||
@@ -24,7 +24,7 @@ describe Admin::PodsController, type: :controller do
|
||||
end
|
||||
|
||||
it "returns the json data" do
|
||||
3.times { FactoryGirl.create(:pod) }
|
||||
3.times { FactoryBot.create(:pod) }
|
||||
|
||||
get :index, format: :json
|
||||
|
||||
@@ -34,7 +34,7 @@ describe Admin::PodsController, type: :controller do
|
||||
|
||||
describe "#recheck" do
|
||||
before do
|
||||
@pod = FactoryGirl.create(:pod).reload
|
||||
@pod = FactoryBot.create(:pod).reload
|
||||
allow(Pod).to receive(:find) { @pod }
|
||||
expect(@pod).to receive(:test_connection!)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
describe Admin::UsersController, :type => :controller do
|
||||
before do
|
||||
@user = FactoryGirl.create :user
|
||||
@user = FactoryBot.create :user
|
||||
Role.add_admin(@user.person)
|
||||
|
||||
sign_in @user, scope: :user
|
||||
@@ -10,7 +10,7 @@ describe Admin::UsersController, :type => :controller do
|
||||
|
||||
describe '#close_account' do
|
||||
it 'queues a job to disable the given account' do
|
||||
other_user = FactoryGirl.create :user
|
||||
other_user = FactoryBot.create :user
|
||||
expect(other_user).to receive(:close_account!)
|
||||
allow(User).to receive(:find).and_return(other_user)
|
||||
|
||||
@@ -20,7 +20,7 @@ describe Admin::UsersController, :type => :controller do
|
||||
|
||||
describe '#lock_account' do
|
||||
it 'it locks the given account' do
|
||||
other_user = FactoryGirl.create :user
|
||||
other_user = FactoryBot.create :user
|
||||
other_user.lock_access!
|
||||
expect(other_user.reload.access_locked?).to be_truthy
|
||||
end
|
||||
@@ -28,7 +28,7 @@ describe Admin::UsersController, :type => :controller do
|
||||
|
||||
describe '#unlock_account' do
|
||||
it 'it unlocks the given account' do
|
||||
other_user = FactoryGirl.create :user
|
||||
other_user = FactoryBot.create :user
|
||||
other_user.lock_access!
|
||||
other_user.unlock_access!
|
||||
expect(other_user.reload.access_locked?).to be_falsey
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
describe AdminsController, :type => :controller do
|
||||
before do
|
||||
@user = FactoryGirl.create :user
|
||||
@user = FactoryBot.create :user
|
||||
sign_in @user, scope: :user
|
||||
end
|
||||
|
||||
@@ -82,11 +82,11 @@ describe AdminsController, :type => :controller do
|
||||
end
|
||||
|
||||
it 'searches on age < 13 (COPPA)' do
|
||||
u_13 = FactoryGirl.create(:user)
|
||||
u_13 = FactoryBot.create(:user)
|
||||
u_13.profile.birthday = 10.years.ago.to_date
|
||||
u_13.profile.save!
|
||||
|
||||
o_13 = FactoryGirl.create(:user)
|
||||
o_13 = FactoryBot.create(:user)
|
||||
o_13.profile.birthday = 20.years.ago.to_date
|
||||
o_13.profile.save!
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Api::OpenidConnect::AuthorizationsController, type: :request do
|
||||
let!(:client) { FactoryGirl.create(:o_auth_application) }
|
||||
let!(:client) { FactoryBot.create(:o_auth_application) }
|
||||
|
||||
before do
|
||||
sign_in alice, scope: :user
|
||||
@@ -89,7 +89,7 @@ describe Api::OpenidConnect::AuthorizationsController, type: :request do
|
||||
context "when multiple redirect URLs are pre-registered" do
|
||||
it "should return an invalid request error" do
|
||||
client_with_multiple_redirects =
|
||||
FactoryGirl.create(:o_auth_application, redirect_uris: %w[http://localhost:3000/ http://localhost/])
|
||||
FactoryBot.create(:o_auth_application, redirect_uris: %w[http://localhost:3000/ http://localhost/])
|
||||
post api_openid_connect_authorizations_new_path, params: {client_id: client_with_multiple_redirects.client_id,
|
||||
response_type: "id_token", scope: "openid", nonce: SecureRandom.hex(16), state: SecureRandom.hex(16)}
|
||||
expect(response.body).to include("The request was malformed")
|
||||
@@ -184,7 +184,7 @@ describe Api::OpenidConnect::AuthorizationsController, type: :request do
|
||||
|
||||
context "when XSS script is passed as name" do
|
||||
it "should escape html" do
|
||||
client_with_xss = FactoryGirl.create(:o_auth_application_with_xss)
|
||||
client_with_xss = FactoryBot.create(:o_auth_application_with_xss)
|
||||
post api_openid_connect_authorizations_new_path, params: {client_id: client_with_xss.client_id,
|
||||
redirect_uri: "http://localhost:3000/",
|
||||
response_type: "id_token", scope: "openid", nonce: SecureRandom.hex(16), state: SecureRandom.hex(16)}
|
||||
@@ -440,7 +440,7 @@ describe Api::OpenidConnect::AuthorizationsController, type: :request do
|
||||
describe "#destroy" do
|
||||
context "with existent authorization" do
|
||||
it "removes the authorization" do
|
||||
auth_with_read = FactoryGirl.create(:auth_with_default_scopes, o_auth_application: client)
|
||||
auth_with_read = FactoryBot.create(:auth_with_default_scopes, o_auth_application: client)
|
||||
delete api_openid_connect_authorization_path(auth_with_read.id)
|
||||
expect(Api::OpenidConnect::Authorization.find_by(id: auth_with_read.id)).to be_nil
|
||||
end
|
||||
|
||||
@@ -145,7 +145,7 @@ describe Api::OpenidConnect::ClientsController, type: :controller, suppress_csrf
|
||||
end
|
||||
|
||||
describe "#find" do
|
||||
let!(:client) { FactoryGirl.create(:o_auth_application) }
|
||||
let!(:client) { FactoryBot.create(:o_auth_application) }
|
||||
|
||||
context "when an OIDC client already exists" do
|
||||
it "should return a client id" do
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Api::OpenidConnect::TokenEndpointController, type: :controller, suppress_csrf_verification: :none do
|
||||
let(:auth) { FactoryGirl.create(:auth_with_default_scopes) }
|
||||
let(:auth) { FactoryBot.create(:auth_with_default_scopes) }
|
||||
|
||||
describe "#create" do
|
||||
it "returns 200 on success" do
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
describe Api::OpenidConnect::UserApplicationsController, type: :controller do
|
||||
before do
|
||||
@app = FactoryGirl.create(:o_auth_application_with_xss)
|
||||
@user = FactoryGirl.create :user
|
||||
FactoryGirl.create :auth_with_default_scopes, user: @user, o_auth_application: @app
|
||||
@app = FactoryBot.create(:o_auth_application_with_xss)
|
||||
@user = FactoryBot.create :user
|
||||
FactoryBot.create :auth_with_default_scopes, user: @user, o_auth_application: @app
|
||||
sign_in @user, scope: :user
|
||||
end
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ describe AspectsController, :type => :controller do
|
||||
end
|
||||
|
||||
it "doesn't overwrite random attributes" do
|
||||
new_user = FactoryGirl.create :user
|
||||
new_user = FactoryBot.create :user
|
||||
params = {"name" => "Bruisers"}
|
||||
params[:user_id] = new_user.id
|
||||
put :update, params: {id: @alices_aspect_1.id, aspect: params}
|
||||
|
||||
@@ -45,7 +45,7 @@ describe CommentsController, :type => :controller do
|
||||
end
|
||||
|
||||
it "doesn't overwrite author_id" do
|
||||
new_user = FactoryGirl.create(:user)
|
||||
new_user = FactoryBot.create(:user)
|
||||
comment_hash[:author_id] = new_user.person.id.to_s
|
||||
post :create, params: comment_hash
|
||||
expect(Comment.find_by_text(comment_hash[:text]).author_id).to eq(alice.person.id)
|
||||
|
||||
@@ -34,10 +34,10 @@ describe ContactsController, :type => :controller do
|
||||
context "format json" do
|
||||
context "for the contacts search" do
|
||||
before do
|
||||
@person1 = FactoryGirl.create(:person)
|
||||
@person1 = FactoryBot.create(:person)
|
||||
bob.share_with(@person1, bob.aspects.first)
|
||||
@person2 = FactoryGirl.create(:person)
|
||||
@person3 = FactoryGirl.create(:person)
|
||||
@person2 = FactoryBot.create(:person)
|
||||
@person3 = FactoryBot.create(:person)
|
||||
bob.contacts.create(person: @person3, aspects: [bob.aspects.first], receiving: true, sharing: true)
|
||||
end
|
||||
|
||||
@@ -108,7 +108,7 @@ describe ContactsController, :type => :controller do
|
||||
context "with an aspect id" do
|
||||
before do
|
||||
@aspect = bob.aspects.create(name: "awesome contacts")
|
||||
@person = FactoryGirl.create(:person)
|
||||
@person = FactoryBot.create(:person)
|
||||
bob.share_with(@person, @aspect)
|
||||
end
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ describe ConversationsController, :type => :controller do
|
||||
end
|
||||
|
||||
it "assigns a json list of contacts that are sharing with the person" do
|
||||
sharing_user = FactoryGirl.create(:user_with_aspect)
|
||||
sharing_user = FactoryBot.create(:user_with_aspect)
|
||||
sharing_user.share_with(alice.person, sharing_user.aspects.first)
|
||||
get :new, params: {modal: true}
|
||||
expect(assigns(:contacts_json))
|
||||
@@ -139,7 +139,7 @@ describe ConversationsController, :type => :controller do
|
||||
end
|
||||
|
||||
it "sets the author to the current_user" do
|
||||
params[:author] = FactoryGirl.create(:user)
|
||||
params[:author] = FactoryBot.create(:user)
|
||||
post :create, params: params, format: :js
|
||||
expect(Message.first.author).to eq(alice.person)
|
||||
expect(Conversation.first.author).to eq(alice.person)
|
||||
@@ -247,9 +247,9 @@ describe ConversationsController, :type => :controller do
|
||||
end
|
||||
|
||||
context "with non-mutual contact" do
|
||||
let(:person1) { FactoryGirl.create(:person) }
|
||||
let(:person2) { FactoryGirl.create(:person) }
|
||||
let(:person3) { FactoryGirl.create(:person) }
|
||||
let(:person1) { FactoryBot.create(:person) }
|
||||
let(:person2) { FactoryBot.create(:person) }
|
||||
let(:person3) { FactoryBot.create(:person) }
|
||||
let(:params) {
|
||||
{
|
||||
conversation: {subject: "secret stuff", text: "text debug"},
|
||||
@@ -306,7 +306,7 @@ describe ConversationsController, :type => :controller do
|
||||
end
|
||||
|
||||
it "sets the author to the current_user" do
|
||||
params[:author] = FactoryGirl.create(:user)
|
||||
params[:author] = FactoryBot.create(:user)
|
||||
post :create, params: params, format: :js
|
||||
expect(Message.first.author).to eq(alice.person)
|
||||
expect(Conversation.first.author).to eq(alice.person)
|
||||
@@ -414,8 +414,8 @@ describe ConversationsController, :type => :controller do
|
||||
end
|
||||
|
||||
context "with non-mutual contact" do
|
||||
let(:contact1) { alice.contacts.create(receiving: false, sharing: true, person: FactoryGirl.create(:person)) }
|
||||
let(:contact2) { alice.contacts.create(receiving: true, sharing: false, person: FactoryGirl.create(:person)) }
|
||||
let(:contact1) { alice.contacts.create(receiving: false, sharing: true, person: FactoryBot.create(:person)) }
|
||||
let(:contact2) { alice.contacts.create(receiving: true, sharing: false, person: FactoryBot.create(:person)) }
|
||||
let(:params) {
|
||||
{
|
||||
conversation: {subject: "secret stuff", text: "text debug"},
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
describe AdminsController, type: :controller do
|
||||
describe "#dashboard" do
|
||||
before do
|
||||
@user = FactoryGirl.create :user
|
||||
@user = FactoryBot.create :user
|
||||
Role.add_admin(@user.person)
|
||||
sign_in @user, scope: :user
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ describe ContactsController, :type => :controller do
|
||||
|
||||
it "generates the aspects_manage_contacts_json fixture", fixture: true do
|
||||
# adds one not mutual contact
|
||||
bob.share_with(FactoryGirl.create(:person), @aspect)
|
||||
bob.share_with(FactoryBot.create(:person), @aspect)
|
||||
|
||||
get :index, params: {a_id: @aspect.id, page: "1"}, format: :json
|
||||
save_fixture(response.body, "aspects_manage_contacts_json")
|
||||
|
||||
@@ -4,10 +4,10 @@ describe NotificationsController, :type => :controller do
|
||||
describe '#index' do
|
||||
before do
|
||||
sign_in alice, scope: :user
|
||||
@post = FactoryGirl.create(:status_message)
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
@post = FactoryBot.create(:status_message)
|
||||
FactoryBot.create(:notification, :recipient => alice, :target => @post)
|
||||
get :read_all
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
FactoryBot.create(:notification, :recipient => alice, :target => @post)
|
||||
eve.share_with(alice.person, eve.aspects.first)
|
||||
end
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ describe StreamsController, :type => :controller do
|
||||
Timecop.travel(time += 1.minute)
|
||||
posts << alice.post(:status_message, :text => "hella infos yo!", :to => alice.aspects.first.id)
|
||||
Timecop.travel(time += 1.minute)
|
||||
posts << alice.post(:reshare, :root_guid => FactoryGirl.create(:status_message, :public => true).guid, :to => 'all')
|
||||
posts << alice.post(:reshare, :root_guid => FactoryBot.create(:status_message, :public => true).guid, :to => 'all')
|
||||
Timecop.travel(time += 1.minute)
|
||||
if i == 9
|
||||
posts << alice.post(:status_message,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
describe LinksController, type: :controller do
|
||||
describe "#resolve" do
|
||||
context "with post" do
|
||||
let(:post) { FactoryGirl.create(:status_message) }
|
||||
let(:post) { FactoryBot.create(:status_message) }
|
||||
let(:link_text) { "#{post.author.diaspora_handle}/post/#{post.guid}" }
|
||||
subject { get :resolve, params: {q: link_query} }
|
||||
|
||||
@@ -34,7 +34,7 @@ describe LinksController, type: :controller do
|
||||
end
|
||||
|
||||
context "when post is non-fetchable" do
|
||||
let(:diaspora_id) { FactoryGirl.create(:person).diaspora_handle }
|
||||
let(:diaspora_id) { FactoryBot.create(:person).diaspora_handle }
|
||||
let(:guid) { "1234567890abcdef" }
|
||||
let(:link_query) { "web+diaspora://#{diaspora_id}/post/#{guid}" }
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ describe MessagesController, :type => :controller do
|
||||
end
|
||||
|
||||
it "doesn't overwrite author_id" do
|
||||
new_user = FactoryGirl.create(:user)
|
||||
new_user = FactoryBot.create(:user)
|
||||
@message_params[:author_id] = new_user.person.id.to_s
|
||||
|
||||
post :create, params: @message_params
|
||||
|
||||
@@ -11,21 +11,21 @@ describe NotificationsController, :type => :controller do
|
||||
|
||||
describe '#update' do
|
||||
it 'marks a notification as read if it gets no other information' do
|
||||
note = FactoryGirl.create(:notification)
|
||||
note = FactoryBot.create(:notification)
|
||||
expect(Notification).to receive(:where).and_return([note])
|
||||
expect(note).to receive(:set_read_state).with(true)
|
||||
get :update, params: {id: note.id}, format: :json
|
||||
end
|
||||
|
||||
it 'marks a notification as read if it is told to' do
|
||||
note = FactoryGirl.create(:notification)
|
||||
note = FactoryBot.create(:notification)
|
||||
expect(Notification).to receive(:where).and_return([note])
|
||||
expect(note).to receive(:set_read_state).with(true)
|
||||
get :update, params: {id: note.id, set_unread: "false"}, format: :json
|
||||
end
|
||||
|
||||
it 'marks a notification as unread if it is told to' do
|
||||
note = FactoryGirl.create(:notification)
|
||||
note = FactoryBot.create(:notification)
|
||||
expect(Notification).to receive(:where).and_return([note])
|
||||
expect(note).to receive(:set_read_state).with(false)
|
||||
get :update, params: {id: note.id, set_unread: "true"}, format: :json
|
||||
@@ -33,7 +33,7 @@ describe NotificationsController, :type => :controller do
|
||||
|
||||
it "marks a notification as unread without timestamping" do
|
||||
note = Timecop.travel(1.hour.ago) do
|
||||
FactoryGirl.create(:notification, recipient: alice, unread: false)
|
||||
FactoryBot.create(:notification, recipient: alice, unread: false)
|
||||
end
|
||||
|
||||
get :update, params: {id: note.id, set_unread: "true"}, format: :json
|
||||
@@ -47,8 +47,8 @@ describe NotificationsController, :type => :controller do
|
||||
it 'only lets you read your own notifications' do
|
||||
user2 = bob
|
||||
|
||||
FactoryGirl.create(:notification, :recipient => alice)
|
||||
note = FactoryGirl.create(:notification, :recipient => user2)
|
||||
FactoryBot.create(:notification, :recipient => alice)
|
||||
note = FactoryBot.create(:notification, :recipient => user2)
|
||||
|
||||
get :update, params: {id: note.id, set_unread: "false"}, format: :json
|
||||
|
||||
@@ -58,8 +58,8 @@ describe NotificationsController, :type => :controller do
|
||||
|
||||
describe '#index' do
|
||||
before do
|
||||
@post = FactoryGirl.create(:status_message)
|
||||
@notification = FactoryGirl.create(:notification, recipient: alice, target: @post)
|
||||
@post = FactoryBot.create(:status_message)
|
||||
@notification = FactoryBot.create(:notification, recipient: alice, target: @post)
|
||||
end
|
||||
|
||||
it 'succeeds' do
|
||||
@@ -98,7 +98,7 @@ describe NotificationsController, :type => :controller do
|
||||
end
|
||||
|
||||
it 'paginates the notifications' do
|
||||
25.times { FactoryGirl.create(:notification, :recipient => alice, :target => @post) }
|
||||
25.times { FactoryBot.create(:notification, :recipient => alice, :target => @post) }
|
||||
get :index
|
||||
expect(assigns[:notifications].count).to eq(25)
|
||||
get :index, params: {page: 2}
|
||||
@@ -106,14 +106,14 @@ describe NotificationsController, :type => :controller do
|
||||
end
|
||||
|
||||
it "supports a limit per_page parameter" do
|
||||
2.times { FactoryGirl.create(:notification, :recipient => alice, :target => @post) }
|
||||
2.times { FactoryBot.create(:notification, :recipient => alice, :target => @post) }
|
||||
get :index, params: {per_page: 2}
|
||||
expect(assigns[:notifications].count).to eq(2)
|
||||
end
|
||||
|
||||
describe "special case for start sharing notifications" do
|
||||
it "should not provide a contacts menu for standard notifications" do
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
FactoryBot.create(:notification, :recipient => alice, :target => @post)
|
||||
get :index, params: {per_page: 5}
|
||||
expect(Nokogiri(response.body).css('.aspect_membership')).to be_empty
|
||||
end
|
||||
@@ -134,15 +134,15 @@ describe NotificationsController, :type => :controller do
|
||||
|
||||
describe "filter notifications" do
|
||||
it "supports filtering by notification type" do
|
||||
FactoryGirl.create(:notification, :recipient => alice, :type => "Notifications::StartedSharing")
|
||||
FactoryBot.create(:notification, :recipient => alice, :type => "Notifications::StartedSharing")
|
||||
get :index, params: {type: "started_sharing"}
|
||||
expect(assigns[:notifications].count).to eq(1)
|
||||
end
|
||||
|
||||
it "supports filtering by read/unread" do
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
FactoryBot.create(:notification, :recipient => alice, :target => @post)
|
||||
get :read_all
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
FactoryBot.create(:notification, :recipient => alice, :target => @post)
|
||||
get :index, params: {show: "unread"}
|
||||
expect(assigns[:notifications].count).to eq(1)
|
||||
end
|
||||
@@ -150,7 +150,7 @@ describe NotificationsController, :type => :controller do
|
||||
|
||||
context "after deleting a person" do
|
||||
before do
|
||||
user = FactoryGirl.create(:user_with_aspect)
|
||||
user = FactoryBot.create(:user_with_aspect)
|
||||
user.share_with(alice.person, user.aspects.first)
|
||||
user.person.delete
|
||||
end
|
||||
@@ -168,12 +168,12 @@ describe NotificationsController, :type => :controller do
|
||||
end
|
||||
|
||||
describe "#read_all" do
|
||||
let(:post) { FactoryGirl.create(:status_message) }
|
||||
let(:post) { FactoryBot.create(:status_message) }
|
||||
|
||||
it "marks all notifications as read" do
|
||||
request.env["HTTP_REFERER"] = "I wish I were spelled right"
|
||||
FactoryGirl.create(:notification, recipient: alice, target: post)
|
||||
FactoryGirl.create(:notification, recipient: alice, target: post)
|
||||
FactoryBot.create(:notification, recipient: alice, target: post)
|
||||
FactoryBot.create(:notification, recipient: alice, target: post)
|
||||
|
||||
expect(Notification.where(unread: true).count).to eq(2)
|
||||
get :read_all
|
||||
@@ -182,39 +182,39 @@ describe NotificationsController, :type => :controller do
|
||||
|
||||
it "marks all notifications in the current filter as read" do
|
||||
request.env["HTTP_REFERER"] = "I wish I were spelled right"
|
||||
FactoryGirl.create(:notification, recipient: alice, target: post)
|
||||
FactoryGirl.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
FactoryBot.create(:notification, recipient: alice, target: post)
|
||||
FactoryBot.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
expect(Notification.where(unread: true).count).to eq(2)
|
||||
get :read_all, params: {type: "started_sharing"}
|
||||
expect(Notification.where(unread: true).count).to eq(1)
|
||||
end
|
||||
|
||||
it "should redirect back in the html version if it has > 0 notifications" do
|
||||
FactoryGirl.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
FactoryBot.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
get :read_all, params: {type: "liked"}, format: :html
|
||||
expect(response).to redirect_to(notifications_path)
|
||||
end
|
||||
|
||||
it "should redirect back in the mobile version if it has > 0 notifications" do
|
||||
FactoryGirl.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
FactoryBot.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
get :read_all, params: {type: "liked"}, format: :mobile
|
||||
expect(response).to redirect_to(notifications_path)
|
||||
end
|
||||
|
||||
it "should redirect to stream in the html version if it has 0 notifications" do
|
||||
FactoryGirl.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
FactoryBot.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
get :read_all, params: {type: "started_sharing"}, format: :html
|
||||
expect(response).to redirect_to(stream_path)
|
||||
end
|
||||
|
||||
it "should redirect back in the mobile version if it has 0 notifications" do
|
||||
FactoryGirl.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
FactoryBot.create(:notification, recipient: alice, type: "Notifications::StartedSharing")
|
||||
get :read_all, params: {type: "started_sharing"}, format: :mobile
|
||||
expect(response).to redirect_to(stream_path)
|
||||
end
|
||||
|
||||
it "should return a dummy value in the json version" do
|
||||
FactoryGirl.create(:notification, recipient: alice, target: post)
|
||||
FactoryBot.create(:notification, recipient: alice, target: post)
|
||||
get :read_all, format: :json
|
||||
expect(response).not_to be_redirect
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ describe ParticipationsController, :type => :controller do
|
||||
end
|
||||
|
||||
describe '#create' do
|
||||
let(:stranger) { FactoryGirl.create(:user) }
|
||||
let(:stranger) { FactoryBot.create(:user) }
|
||||
|
||||
shared_examples 'on a visible post' do
|
||||
it 'creates the participation' do
|
||||
@@ -57,7 +57,7 @@ describe ParticipationsController, :type => :controller do
|
||||
end
|
||||
|
||||
describe '#destroy' do
|
||||
let(:post) { FactoryGirl.create(:status_message) }
|
||||
let(:post) { FactoryBot.create(:status_message) }
|
||||
|
||||
context 'on a post you partecipate to' do
|
||||
before { alice.participate! post }
|
||||
|
||||
@@ -15,18 +15,18 @@ describe PeopleController, :type => :controller do
|
||||
|
||||
describe '#index (search)' do
|
||||
before do
|
||||
@eugene = FactoryGirl.create(
|
||||
@eugene = FactoryBot.create(
|
||||
:person,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Eugene", last_name: "w")
|
||||
profile: FactoryBot.build(:profile, first_name: "Eugene", last_name: "w")
|
||||
)
|
||||
@korth = FactoryGirl.create(
|
||||
@korth = FactoryBot.create(
|
||||
:person,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Evan", last_name: "Korth")
|
||||
profile: FactoryBot.build(:profile, first_name: "Evan", last_name: "Korth")
|
||||
)
|
||||
@closed = FactoryGirl.create(
|
||||
@closed = FactoryBot.create(
|
||||
:person,
|
||||
closed_account: true,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Closed", last_name: "Account")
|
||||
profile: FactoryBot.build(:profile, first_name: "Closed", last_name: "Account")
|
||||
)
|
||||
end
|
||||
|
||||
@@ -57,8 +57,8 @@ describe PeopleController, :type => :controller do
|
||||
describe 'via html' do
|
||||
context 'query is a diaspora ID' do
|
||||
before do
|
||||
@unsearchable_eugene = FactoryGirl.create(:person, :diaspora_handle => "eugene@example.org",
|
||||
:profile => FactoryGirl.build(:profile, :first_name => "Eugene",
|
||||
@unsearchable_eugene = FactoryBot.create(:person, :diaspora_handle => "eugene@example.org",
|
||||
:profile => FactoryBot.build(:profile, :first_name => "Eugene",
|
||||
:last_name => "w", :searchable => false))
|
||||
end
|
||||
it 'finds people even if they have searchable off' do
|
||||
@@ -99,8 +99,8 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it "assigns people" do
|
||||
eugene2 = FactoryGirl.create(:person,
|
||||
:profile => FactoryGirl.build(:profile, :first_name => "Eugene",
|
||||
eugene2 = FactoryBot.create(:person,
|
||||
:profile => FactoryBot.build(:profile, :first_name => "Eugene",
|
||||
:last_name => "w"))
|
||||
get :index, params: {q: "Eug"}
|
||||
expect(assigns[:people].map { |x| x.id }).to match_array([@eugene.id, eugene2.id])
|
||||
@@ -129,8 +129,8 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it "excludes people who have searchable off" do
|
||||
eugene2 = FactoryGirl.create(:person,
|
||||
:profile => FactoryGirl.build(:profile, :first_name => "Eugene",
|
||||
eugene2 = FactoryBot.create(:person,
|
||||
:profile => FactoryBot.build(:profile, :first_name => "Eugene",
|
||||
:last_name => "w", :searchable => false))
|
||||
get :index, params: {q: "Eug"}
|
||||
expect(assigns[:people]).not_to match_array([eugene2])
|
||||
@@ -150,7 +150,7 @@ describe PeopleController, :type => :controller do
|
||||
@posts = []
|
||||
@users = []
|
||||
8.times do |n|
|
||||
user = FactoryGirl.create(:user)
|
||||
user = FactoryBot.create(:user)
|
||||
@users << user
|
||||
aspect = user.aspects.create(:name => 'people')
|
||||
connect_users(@user, @user.aspects.first, user, aspect)
|
||||
@@ -173,7 +173,7 @@ describe PeopleController, :type => :controller do
|
||||
|
||||
describe '#show' do
|
||||
before do
|
||||
@person = FactoryGirl.create(:user).person
|
||||
@person = FactoryBot.create(:user).person
|
||||
@presenter = PersonPresenter.new(@person, @user)
|
||||
end
|
||||
|
||||
@@ -214,7 +214,7 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it 'redirects home for closed account' do
|
||||
@person = FactoryGirl.create(:person, :closed_account => true)
|
||||
@person = FactoryBot.create(:person, :closed_account => true)
|
||||
get :show, params: {id: @person.to_param}
|
||||
expect(response).to be_redirect
|
||||
expect(flash[:notice]).not_to be_blank
|
||||
@@ -275,7 +275,7 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it 'forces to sign in if the person is remote' do
|
||||
p = FactoryGirl.create(:person)
|
||||
p = FactoryBot.create(:person)
|
||||
|
||||
get :show, params: {id: p.to_param}
|
||||
expect(response).to be_redirect
|
||||
@@ -325,7 +325,7 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it 'marks a corresponding notifications as read' do
|
||||
note = FactoryGirl.create(:notification, :recipient => @user, :target => @person, :unread => true)
|
||||
note = FactoryBot.create(:notification, :recipient => @user, :target => @person, :unread => true)
|
||||
|
||||
expect {
|
||||
get :show, params: {id: @person.to_param}
|
||||
@@ -417,7 +417,7 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it "includes reshares" do
|
||||
reshare = @user.post(:reshare, :public => true, :root_guid => FactoryGirl.create(:status_message, :public => true).guid, :to => alice.aspect_ids)
|
||||
reshare = @user.post(:reshare, :public => true, :root_guid => FactoryBot.create(:status_message, :public => true).guid, :to => alice.aspect_ids)
|
||||
get :stream, params: {person_id: @user.person.to_param}, format: :json
|
||||
expect(assigns[:stream].posts.map { |x| x.id }).to include(reshare.id)
|
||||
end
|
||||
@@ -455,7 +455,7 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it "posts include reshares" do
|
||||
reshare = @user.post(:reshare, :public => true, :root_guid => FactoryGirl.create(:status_message, :public => true).guid, :to => alice.aspect_ids)
|
||||
reshare = @user.post(:reshare, :public => true, :root_guid => FactoryBot.create(:status_message, :public => true).guid, :to => alice.aspect_ids)
|
||||
get :stream, params: {person_id: @user.person.to_param}, format: :json
|
||||
expect(assigns[:stream].posts.map { |x| x.id }).to include(reshare.id)
|
||||
end
|
||||
@@ -479,7 +479,7 @@ describe PeopleController, :type => :controller do
|
||||
end
|
||||
|
||||
it "posts include reshares" do
|
||||
reshare = @user.post(:reshare, :public => true, :root_guid => FactoryGirl.create(:status_message, :public => true).guid, :to => alice.aspect_ids)
|
||||
reshare = @user.post(:reshare, :public => true, :root_guid => FactoryBot.create(:status_message, :public => true).guid, :to => alice.aspect_ids)
|
||||
get :stream, params: {person_id: @user.person.to_param}, format: :json
|
||||
expect(assigns[:stream].posts.map { |x| x.id }).to include(reshare.id)
|
||||
end
|
||||
@@ -499,7 +499,7 @@ describe PeopleController, :type => :controller do
|
||||
|
||||
describe '#hovercard' do
|
||||
before do
|
||||
@hover_test = FactoryGirl.create(:person)
|
||||
@hover_test = FactoryBot.create(:person)
|
||||
@hover_test.profile.tag_string = '#test #tags'
|
||||
@hover_test.profile.save!
|
||||
end
|
||||
@@ -542,18 +542,18 @@ describe PeopleController, :type => :controller do
|
||||
|
||||
describe '#refresh_search ' do
|
||||
before(:each)do
|
||||
@eugene = FactoryGirl.create(
|
||||
@eugene = FactoryBot.create(
|
||||
:person,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Eugene", last_name: "w")
|
||||
profile: FactoryBot.build(:profile, first_name: "Eugene", last_name: "w")
|
||||
)
|
||||
@korth = FactoryGirl.create(
|
||||
@korth = FactoryBot.create(
|
||||
:person,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Evan", last_name: "Korth")
|
||||
profile: FactoryBot.build(:profile, first_name: "Evan", last_name: "Korth")
|
||||
)
|
||||
@closed = FactoryGirl.create(
|
||||
@closed = FactoryBot.create(
|
||||
:person,
|
||||
closed_account: true,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Closed", last_name: "Account")
|
||||
profile: FactoryBot.build(:profile, first_name: "Closed", last_name: "Account")
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -54,14 +54,14 @@ describe PhotosController, :type => :controller do
|
||||
end
|
||||
|
||||
it "doesn't allow mass assignment of person" do
|
||||
new_user = FactoryGirl.create(:user)
|
||||
new_user = FactoryBot.create(:user)
|
||||
@params[:photo][:author] = new_user
|
||||
post :create, params: @params
|
||||
expect(Photo.last.author).to eq(alice.person)
|
||||
end
|
||||
|
||||
it "doesn't allow mass assignment of person_id" do
|
||||
new_user = FactoryGirl.create(:user)
|
||||
new_user = FactoryBot.create(:user)
|
||||
@params[:photo][:author_id] = new_user.id
|
||||
post :create, params: @params
|
||||
expect(Photo.last.author).to eq(alice.person)
|
||||
@@ -79,13 +79,13 @@ describe PhotosController, :type => :controller do
|
||||
|
||||
describe '#index' do
|
||||
it "succeeds without any available pictures" do
|
||||
get :index, params: {person_id: FactoryGirl.create(:person).guid}
|
||||
get :index, params: {person_id: FactoryBot.create(:person).guid}
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "succeeds on mobile devices without any available pictures" do
|
||||
get :index, params: {person_id: FactoryGirl.create(:person).guid}, format: :mobile
|
||||
get :index, params: {person_id: FactoryBot.create(:person).guid}, format: :mobile
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ describe PhotosController, :type => :controller do
|
||||
end
|
||||
|
||||
it "forces to sign in if the person is remote" do
|
||||
p = FactoryGirl.create(:person)
|
||||
p = FactoryBot.create(:person)
|
||||
|
||||
get :index, params: {person_id: p.to_param}
|
||||
expect(response).to be_redirect
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe PollParticipationsController, type: :controller do
|
||||
let(:poll_post) { FactoryGirl.create(:status_message_with_poll, public: true) }
|
||||
let(:poll_post) { FactoryBot.create(:status_message_with_poll, public: true) }
|
||||
let(:poll_answer) { poll_post.poll.poll_answers.first }
|
||||
|
||||
before do
|
||||
|
||||
@@ -23,7 +23,7 @@ describe PostsController, type: :controller do
|
||||
end
|
||||
|
||||
it "succeeds after removing a mention when closing the mentioned user's account" do
|
||||
user = FactoryGirl.create(:user, username: "user")
|
||||
user = FactoryBot.create(:user, username: "user")
|
||||
alice.share_with(user.person, alice.aspects.first)
|
||||
|
||||
msg = alice.post(:status_message, text: "Mention @{User ; #{user.diaspora_handle}}", public: true)
|
||||
@@ -41,7 +41,7 @@ describe PostsController, type: :controller do
|
||||
end
|
||||
|
||||
it "succeeds on mobile with a reshare" do
|
||||
reshare_id = FactoryGirl.create(:reshare, author: alice.person).id
|
||||
reshare_id = FactoryBot.create(:reshare, author: alice.person).id
|
||||
expect_any_instance_of(PostService).to receive(:mark_user_notifications).with(reshare_id)
|
||||
|
||||
get :show, params: {id: reshare_id}, format: :mobile
|
||||
|
||||
@@ -10,7 +10,7 @@ describe ProfilesController, :type => :controller do
|
||||
end
|
||||
|
||||
describe '#show' do
|
||||
let(:mock_person) { FactoryGirl.create(:user) }
|
||||
let(:mock_person) { FactoryBot.create(:user) }
|
||||
let(:mock_presenter) { double(:as_json => {:rock_star => "Jamie Cai"})}
|
||||
|
||||
it "returns a post Presenter" do
|
||||
@@ -147,7 +147,7 @@ describe ProfilesController, :type => :controller do
|
||||
|
||||
context 'mass assignment' do
|
||||
before do
|
||||
new_person = FactoryGirl.create(:person)
|
||||
new_person = FactoryBot.create(:person)
|
||||
@profile_params = {:profile =>{ :person_id => new_person.id,
|
||||
:diaspora_handle => 'abc@a.com'}}
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ describe ResharesController, :type => :controller do
|
||||
}
|
||||
|
||||
before do
|
||||
@post = FactoryGirl.create(:status_message, :public => true)
|
||||
@post = FactoryBot.create(:status_message, :public => true)
|
||||
@post_guid = @post.guid
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ describe ResharesController, :type => :controller do
|
||||
|
||||
context 'resharing a reshared post' do
|
||||
before do
|
||||
FactoryGirl.create(:reshare, :root => @post, :author => bob.person)
|
||||
FactoryBot.create(:reshare, :root => @post, :author => bob.person)
|
||||
end
|
||||
|
||||
it 'doesn\'t allow the user to reshare the post again' do
|
||||
@@ -54,7 +54,7 @@ describe ResharesController, :type => :controller do
|
||||
context 'resharing another user\'s reshare' do
|
||||
before do
|
||||
@root = @post
|
||||
@post = FactoryGirl.create(:reshare, :root => @root, :author => alice.person)
|
||||
@post = FactoryBot.create(:reshare, :root => @root, :author => alice.person)
|
||||
end
|
||||
|
||||
it 'reshares the absolute root' do
|
||||
|
||||
@@ -22,7 +22,7 @@ describe ServicesController, :type => :controller do
|
||||
|
||||
describe '#index' do
|
||||
before do
|
||||
FactoryGirl.create(:service, user: user)
|
||||
FactoryBot.create(:service, user: user)
|
||||
end
|
||||
|
||||
it "displays user's connected services" do
|
||||
@@ -118,7 +118,7 @@ describe ServicesController, :type => :controller do
|
||||
|
||||
describe '#destroy' do
|
||||
before do
|
||||
@service1 = FactoryGirl.create(:service, :user => user)
|
||||
@service1 = FactoryBot.create(:service, :user => user)
|
||||
end
|
||||
|
||||
it 'destroys a service selected by id' do
|
||||
|
||||
@@ -32,7 +32,7 @@ describe StreamsController, :type => :controller do
|
||||
|
||||
context "getting started" do
|
||||
it "add the inviter to gon" do
|
||||
user = FactoryGirl.create(:user, getting_started: true, invited_by: alice)
|
||||
user = FactoryBot.create(:user, getting_started: true, invited_by: alice)
|
||||
sign_in user
|
||||
|
||||
get :multi
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
describe TwoFactorAuthenticationsController, type: :controller do
|
||||
before do
|
||||
@user = FactoryGirl.create :user
|
||||
@user = FactoryBot.create :user
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ describe UsersController, :type => :controller do
|
||||
describe '#public' do
|
||||
context "entry xml contents" do
|
||||
before do
|
||||
@sm = FactoryGirl.create(
|
||||
@sm = FactoryBot.create(
|
||||
:status_message,
|
||||
public: true,
|
||||
author: @user.person,
|
||||
@@ -78,7 +78,7 @@ describe UsersController, :type => :controller do
|
||||
end
|
||||
|
||||
it "contains the original author for reshares" do
|
||||
FactoryGirl.create(:reshare, root: @sm, author: bob.person)
|
||||
FactoryBot.create(:reshare, root: @sm, author: bob.person)
|
||||
get :public, params: {username: bob.username}, format: :atom
|
||||
doc = Nokogiri::XML(response.body)
|
||||
expect(doc.css("entry author name")[0].content).to eq(@sm.author_name)
|
||||
@@ -86,14 +86,14 @@ describe UsersController, :type => :controller do
|
||||
end
|
||||
|
||||
it 'includes reshares in the atom feed' do
|
||||
reshare = FactoryGirl.create(:reshare, :author => @user.person)
|
||||
reshare = FactoryBot.create(:reshare, :author => @user.person)
|
||||
get :public, params: {username: @user.username}, format: :atom
|
||||
expect(response.body).to include reshare.root.text
|
||||
end
|
||||
|
||||
it 'do not show reshares in atom feed if origin post is deleted' do
|
||||
post = FactoryGirl.create(:status_message, :public => true);
|
||||
reshare = FactoryGirl.create(:reshare, :root => post, :author => @user.person)
|
||||
post = FactoryBot.create(:status_message, :public => true);
|
||||
reshare = FactoryBot.create(:reshare, :root => post, :author => @user.person)
|
||||
post.delete
|
||||
get :public, params: {username: @user.username}, format: :atom
|
||||
expect(response.code).to eq('200')
|
||||
|
||||
@@ -14,35 +14,35 @@ end
|
||||
|
||||
require "diaspora_federation/test/factories"
|
||||
|
||||
FactoryGirl.define do
|
||||
FactoryBot.define do
|
||||
factory :profile do
|
||||
sequence(:first_name) { |n| "Robert#{n}#{r_str}" }
|
||||
sequence(:last_name) { |n| "Grimm#{n}#{r_str}" }
|
||||
bio "I am a cat lover and I love to run"
|
||||
gender "robot"
|
||||
location "Earth"
|
||||
birthday Date.today
|
||||
tag_string "#one #two"
|
||||
bio { "I am a cat lover and I love to run" }
|
||||
gender { "robot" }
|
||||
location { "Earth" }
|
||||
birthday { Date.today }
|
||||
tag_string { "#one #two" }
|
||||
association :person
|
||||
end
|
||||
|
||||
factory :profile_with_image_url, :parent => :profile do
|
||||
image_url "http://example.com/image.jpg"
|
||||
image_url_medium "http://example.com/image_mid.jpg"
|
||||
image_url_small "http://example.com/image_small.jpg"
|
||||
image_url { "http://example.com/image.jpg" }
|
||||
image_url_medium { "http://example.com/image_mid.jpg" }
|
||||
image_url_small { "http://example.com/image_small.jpg" }
|
||||
end
|
||||
|
||||
factory(:person, aliases: %i(author)) do
|
||||
transient do
|
||||
first_name nil
|
||||
first_name { nil }
|
||||
end
|
||||
|
||||
sequence(:diaspora_handle) {|n| "bob-person-#{n}#{r_str}@example.net" }
|
||||
pod { Pod.find_or_create_by(url: "http://example.net") }
|
||||
serialized_public_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
||||
serialized_public_key { OpenSSL::PKey::RSA.generate(1024).public_key.export }
|
||||
after(:build) do |person, evaluator|
|
||||
unless person.profile.first_name.present?
|
||||
person.profile = FactoryGirl.build(:profile, person: person)
|
||||
person.profile = FactoryBot.build(:profile, person: person)
|
||||
person.profile.first_name = evaluator.first_name if evaluator.first_name
|
||||
end
|
||||
end
|
||||
@@ -66,17 +66,17 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory :user do
|
||||
getting_started false
|
||||
getting_started { false }
|
||||
sequence(:username) { |n| "bob#{n}#{r_str}" }
|
||||
sequence(:email) { |n| "bob#{n}#{r_str}@pivotallabs.com" }
|
||||
password "bluepin7"
|
||||
password { "bluepin7" }
|
||||
password_confirmation { |u| u.password }
|
||||
serialized_private_key OpenSSL::PKey::RSA.generate(1024).export
|
||||
serialized_private_key { OpenSSL::PKey::RSA.generate(1024).export }
|
||||
transient do
|
||||
profile nil
|
||||
profile { nil }
|
||||
end
|
||||
after(:build) do |u, e|
|
||||
u.person = FactoryGirl.build(:person,
|
||||
u.person = FactoryBot.build(:person,
|
||||
pod: nil,
|
||||
serialized_public_key: u.encryption_key.public_key.export,
|
||||
diaspora_handle: "#{u.username}#{User.diaspora_id_host}")
|
||||
@@ -90,11 +90,11 @@ FactoryGirl.define do
|
||||
|
||||
factory :user_with_aspect, parent: :user do
|
||||
transient do
|
||||
friends []
|
||||
friends { [] }
|
||||
end
|
||||
|
||||
after(:create) do |user, evaluator|
|
||||
FactoryGirl.create(:aspect, user: user)
|
||||
FactoryBot.create(:aspect, user: user)
|
||||
evaluator.friends.each do |friend|
|
||||
connect_users_with_aspects(user, friend)
|
||||
end
|
||||
@@ -102,7 +102,7 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory :aspect do
|
||||
name "generic"
|
||||
name { "generic" }
|
||||
user
|
||||
end
|
||||
|
||||
@@ -112,20 +112,20 @@ FactoryGirl.define do
|
||||
|
||||
factory(:status_message_with_poll) do
|
||||
after(:build) do |sm|
|
||||
FactoryGirl.create(:poll, status_message: sm)
|
||||
FactoryBot.create(:poll, status_message: sm)
|
||||
end
|
||||
end
|
||||
|
||||
factory(:status_message_with_location) do
|
||||
after(:build) do |sm|
|
||||
FactoryGirl.create(:location, status_message: sm)
|
||||
FactoryBot.create(:location, status_message: sm)
|
||||
end
|
||||
end
|
||||
|
||||
factory(:status_message_with_photo) do
|
||||
sequence(:text) {|n| "There are #{n} ninjas in this photo." }
|
||||
after(:build) do |sm|
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:photo,
|
||||
author: sm.author,
|
||||
status_message: sm,
|
||||
@@ -136,8 +136,8 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory(:status_message_in_aspect) do
|
||||
public false
|
||||
author { FactoryGirl.create(:user_with_aspect).person }
|
||||
public { false }
|
||||
author { FactoryBot.create(:user_with_aspect).person }
|
||||
after(:build) do |sm|
|
||||
sm.aspects << sm.author.owner.aspects.first
|
||||
end
|
||||
@@ -145,7 +145,7 @@ FactoryGirl.define do
|
||||
|
||||
factory(:status_message_with_participations) do
|
||||
transient do
|
||||
participants []
|
||||
participants { [] }
|
||||
end
|
||||
after(:build) do |sm, ev|
|
||||
ev.participants.each do |participant|
|
||||
@@ -176,8 +176,8 @@ FactoryGirl.define do
|
||||
sequence(:question) {|n| "What do you think about #{n} ninjas?" }
|
||||
association :status_message
|
||||
after(:build) do |p|
|
||||
p.poll_answers << FactoryGirl.build(:poll_answer, poll: p)
|
||||
p.poll_answers << FactoryGirl.build(:poll_answer, poll: p)
|
||||
p.poll_answers << FactoryBot.build(:poll_answer, poll: p)
|
||||
p.poll_answers << FactoryBot.build(:poll_answer, poll: p)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -195,8 +195,8 @@ FactoryGirl.define do
|
||||
factory(:photo) do
|
||||
sequence(:random_string) {|n| SecureRandom.hex(10) }
|
||||
association :author, :factory => :person
|
||||
height 42
|
||||
width 23
|
||||
height { 42 }
|
||||
width { 23 }
|
||||
after(:build) do |p|
|
||||
p.unprocessed_image.store! File.open(File.join(File.dirname(__FILE__), 'fixtures', 'button.png'))
|
||||
p.update_remote_path
|
||||
@@ -204,11 +204,11 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory(:remote_photo, :parent => :photo) do
|
||||
remote_photo_path 'https://photo.com/images/'
|
||||
remote_photo_name 'kittehs.jpg'
|
||||
remote_photo_path { 'https://photo.com/images/' }
|
||||
remote_photo_name { 'kittehs.jpg' }
|
||||
association :author,:factory => :person
|
||||
processed_image nil
|
||||
unprocessed_image nil
|
||||
processed_image { nil }
|
||||
unprocessed_image { nil }
|
||||
end
|
||||
|
||||
factory :reshare do
|
||||
@@ -217,8 +217,8 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory :invitation do
|
||||
service "email"
|
||||
identifier "bob.smith@smith.com"
|
||||
service { "email" }
|
||||
identifier { "bob.smith@smith.com" }
|
||||
association :sender, :factory => :user_with_aspect
|
||||
after(:build) do |i|
|
||||
i.aspect = i.sender.aspects.first
|
||||
@@ -228,12 +228,12 @@ FactoryGirl.define do
|
||||
factory :invitation_code do
|
||||
sequence(:token){|n| "sdfsdsf#{n}"}
|
||||
association :user
|
||||
count 0
|
||||
count { 0 }
|
||||
end
|
||||
|
||||
factory :service do |service|
|
||||
nickname "sirrobertking"
|
||||
type "Services::Twitter"
|
||||
nickname { "sirrobertking" }
|
||||
type { "Services::Twitter" }
|
||||
|
||||
sequence(:uid) { |token| "00000#{token}" }
|
||||
sequence(:access_token) { |token| "12345#{token}" }
|
||||
@@ -244,7 +244,7 @@ FactoryGirl.define do
|
||||
|
||||
factory :pod do
|
||||
sequence(:host) {|n| "pod#{n}.example#{r_str}.com" }
|
||||
ssl true
|
||||
ssl { true }
|
||||
end
|
||||
|
||||
factory(:comment) do
|
||||
@@ -257,8 +257,8 @@ FactoryGirl.define do
|
||||
association(:parent, factory: :status_message)
|
||||
|
||||
after(:build) do |comment|
|
||||
order = SignatureOrder.first || FactoryGirl.create(:signature_order)
|
||||
comment.signature = FactoryGirl.build(:comment_signature, comment: comment, signature_order: order)
|
||||
order = SignatureOrder.first || FactoryBot.create(:signature_order)
|
||||
comment.signature = FactoryBot.build(:comment_signature, comment: comment, signature_order: order)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -272,26 +272,26 @@ FactoryGirl.define do
|
||||
association :target, :factory => :comment
|
||||
|
||||
after(:build) do |note|
|
||||
note.actors << FactoryGirl.build(:person)
|
||||
note.actors << FactoryBot.build(:person)
|
||||
end
|
||||
end
|
||||
|
||||
factory(:notification_mentioned_in_comment, class: Notification) do
|
||||
association :recipient, factory: :user
|
||||
type "Notifications::MentionedInComment"
|
||||
type { "Notifications::MentionedInComment" }
|
||||
|
||||
after(:build) do |note|
|
||||
note.actors << FactoryGirl.build(:person)
|
||||
note.target = FactoryGirl.create :mention_in_comment, person: note.recipient.person
|
||||
note.actors << FactoryBot.build(:person)
|
||||
note.target = FactoryBot.create :mention_in_comment, person: note.recipient.person
|
||||
end
|
||||
end
|
||||
|
||||
factory(:tag, :class => ActsAsTaggableOn::Tag) do
|
||||
name "partytimeexcellent"
|
||||
name { "partytimeexcellent" }
|
||||
end
|
||||
|
||||
factory(:o_embed_cache) do
|
||||
url "http://youtube.com/kittens"
|
||||
url { "http://youtube.com/kittens" }
|
||||
data {
|
||||
{
|
||||
"data" => "foo",
|
||||
@@ -301,12 +301,12 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory(:open_graph_cache) do
|
||||
url "http://example.com/articles/123"
|
||||
image "http://example.com/images/123.jpg"
|
||||
title "Some article"
|
||||
ob_type "article"
|
||||
description "This is the article lead"
|
||||
video_url "http://example.com/videos/123.html"
|
||||
url { "http://example.com/articles/123" }
|
||||
image { "http://example.com/images/123.jpg" }
|
||||
title { "Some article" }
|
||||
ob_type { "article" }
|
||||
description { "This is the article lead" }
|
||||
video_url { "http://example.com/videos/123.html" }
|
||||
end
|
||||
|
||||
factory(:tag_following) do
|
||||
@@ -340,7 +340,7 @@ FactoryGirl.define do
|
||||
|
||||
factory(:conversation_with_message, parent: :conversation) do
|
||||
after(:create) do |c|
|
||||
msg = FactoryGirl.build(:message, author: c.author)
|
||||
msg = FactoryBot.build(:message, author: c.author)
|
||||
msg.conversation_id = c.id
|
||||
msg.save
|
||||
end
|
||||
@@ -354,34 +354,34 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory(:signature_order) do
|
||||
order "guid parent_guid text author"
|
||||
order { "guid parent_guid text author" }
|
||||
end
|
||||
|
||||
factory(:comment_signature) do
|
||||
author_signature "some signature"
|
||||
author_signature { "some signature" }
|
||||
association :signature_order, order: "guid parent_guid text author new_property"
|
||||
additional_data { {"new_property" => "some text"} }
|
||||
end
|
||||
|
||||
factory(:like_signature) do
|
||||
author_signature "some signature"
|
||||
author_signature { "some signature" }
|
||||
association :signature_order, order: "positive guid parent_type parent_guid author new_property"
|
||||
additional_data { {"new_property" => "some text"} }
|
||||
end
|
||||
|
||||
factory :role do
|
||||
association :person
|
||||
name "moderator"
|
||||
name { "moderator" }
|
||||
end
|
||||
|
||||
factory(:poll_participation_signature) do
|
||||
author_signature "some signature"
|
||||
author_signature { "some signature" }
|
||||
association :signature_order, order: "guid parent_guid author poll_answer_guid new_property"
|
||||
additional_data { {"new_property" => "some text"} }
|
||||
end
|
||||
|
||||
factory(:note, :parent => :status_message) do
|
||||
text SecureRandom.hex(1000)
|
||||
text { SecureRandom.hex(1000) }
|
||||
end
|
||||
|
||||
factory(:status, parent: :status_message)
|
||||
@@ -394,28 +394,28 @@ FactoryGirl.define do
|
||||
factory :report do
|
||||
user
|
||||
association :item, factory: :status_message
|
||||
text "offensive content"
|
||||
text { "offensive content" }
|
||||
end
|
||||
|
||||
factory :o_auth_application, class: Api::OpenidConnect::OAuthApplication do
|
||||
client_name { "Diaspora Test Client #{r_str}" }
|
||||
redirect_uris %w(http://localhost:3000/)
|
||||
redirect_uris { %w(http://localhost:3000/) }
|
||||
end
|
||||
|
||||
factory :o_auth_application_with_ppid, parent: :o_auth_application do
|
||||
ppid true
|
||||
sector_identifier_uri "https://example.com/uri"
|
||||
ppid { true }
|
||||
sector_identifier_uri { "https://example.com/uri" }
|
||||
end
|
||||
|
||||
factory :o_auth_application_with_xss, class: Api::OpenidConnect::OAuthApplication do
|
||||
client_name "<script>alert(0);</script>"
|
||||
redirect_uris %w(http://localhost:3000/)
|
||||
client_name { "<script>alert(0);</script>" }
|
||||
redirect_uris { %w(http://localhost:3000/) }
|
||||
end
|
||||
|
||||
factory :auth_with_default_scopes, class: Api::OpenidConnect::Authorization do
|
||||
o_auth_application
|
||||
user
|
||||
scopes %w[openid public:read]
|
||||
scopes { %w[openid public:read] }
|
||||
after(:build) {|m|
|
||||
m.redirect_uri = m.o_auth_application.redirect_uris[0]
|
||||
}
|
||||
@@ -424,7 +424,7 @@ FactoryGirl.define do
|
||||
factory :auth_with_profile_and_ppid, class: Api::OpenidConnect::Authorization do
|
||||
association :o_auth_application, factory: :o_auth_application_with_ppid
|
||||
user
|
||||
scopes %w[openid sub profile picture nickname name]
|
||||
scopes { %w[openid sub profile picture nickname name] }
|
||||
after(:build) {|m|
|
||||
m.redirect_uri = m.o_auth_application.redirect_uris[0]
|
||||
}
|
||||
@@ -433,7 +433,7 @@ FactoryGirl.define do
|
||||
factory :auth_with_all_scopes, class: Api::OpenidConnect::Authorization do
|
||||
o_auth_application
|
||||
association :user, factory: :user_with_aspect
|
||||
scopes Api::OpenidConnect::Authorization::SCOPES
|
||||
scopes { Api::OpenidConnect::Authorization::SCOPES }
|
||||
after(:build) {|m|
|
||||
m.redirect_uri = m.o_auth_application.redirect_uris[0]
|
||||
}
|
||||
@@ -442,9 +442,9 @@ FactoryGirl.define do
|
||||
factory :auth_with_all_scopes_not_private, class: Api::OpenidConnect::Authorization do
|
||||
o_auth_application
|
||||
association :user, factory: :user_with_aspect
|
||||
scopes %w[openid sub name nickname profile picture gender birthdate locale updated_at contacts:read contacts:modify
|
||||
scopes { %w[openid sub name nickname profile picture gender birthdate locale updated_at contacts:read contacts:modify
|
||||
conversations email interactions notifications public:read public:modify profile profile:modify tags:read
|
||||
tags:modify]
|
||||
tags:modify] }
|
||||
after(:build) {|m|
|
||||
m.redirect_uri = m.o_auth_application.redirect_uris[0]
|
||||
}
|
||||
@@ -453,8 +453,8 @@ FactoryGirl.define do
|
||||
factory :auth_with_read_scopes, class: Api::OpenidConnect::Authorization do
|
||||
o_auth_application
|
||||
association :user, factory: :user_with_aspect
|
||||
scopes %w[openid sub name nickname profile picture contacts:read conversations
|
||||
email interactions notifications private:read public:read profile tags:read]
|
||||
scopes { %w[openid sub name nickname profile picture contacts:read conversations
|
||||
email interactions notifications private:read public:read profile tags:read] }
|
||||
after(:build) {|m|
|
||||
m.redirect_uri = m.o_auth_application.redirect_uris[0]
|
||||
}
|
||||
@@ -463,8 +463,8 @@ FactoryGirl.define do
|
||||
factory :auth_with_read_scopes_not_private, class: Api::OpenidConnect::Authorization do
|
||||
o_auth_application
|
||||
association :user, factory: :user_with_aspect
|
||||
scopes %w[openid sub name nickname profile picture gender contacts:read conversations
|
||||
email interactions notifications public:read profile tags:read]
|
||||
scopes { %w[openid sub name nickname profile picture gender contacts:read conversations
|
||||
email interactions notifications public:read profile tags:read] }
|
||||
after(:build) {|m|
|
||||
m.redirect_uri = m.o_auth_application.redirect_uris[0]
|
||||
}
|
||||
@@ -475,27 +475,27 @@ FactoryGirl.define do
|
||||
factory(:federation_person_from_webfinger, class: DiasporaFederation::Entities::Person) do
|
||||
sequence(:guid) { UUID.generate :compact }
|
||||
sequence(:diaspora_id) {|n| "bob-person-#{n}#{r_str}@example.net" }
|
||||
url "https://example.net/"
|
||||
exported_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
||||
url { "https://example.net/" }
|
||||
exported_key { OpenSSL::PKey::RSA.generate(1024).public_key.export }
|
||||
profile {
|
||||
DiasporaFederation::Entities::Profile.new(
|
||||
FactoryGirl.attributes_for(:federation_profile_from_hcard, diaspora_id: diaspora_id))
|
||||
FactoryBot.attributes_for(:federation_profile_from_hcard, diaspora_id: diaspora_id))
|
||||
}
|
||||
end
|
||||
|
||||
factory(:federation_profile_from_hcard, class: DiasporaFederation::Entities::Profile) do
|
||||
sequence(:diaspora_id) {|n| "bob-person-#{n}#{r_str}@example.net" }
|
||||
sequence(:first_name) {|n| "My Name#{n}#{r_str}" }
|
||||
last_name nil
|
||||
image_url "/assets/user/default.png"
|
||||
image_url_medium "/assets/user/default.png"
|
||||
image_url_small "/assets/user/default.png"
|
||||
searchable true
|
||||
last_name { nil }
|
||||
image_url { "/assets/user/default.png" }
|
||||
image_url_medium { "/assets/user/default.png" }
|
||||
image_url_small { "/assets/user/default.png" }
|
||||
searchable { true }
|
||||
end
|
||||
|
||||
factory :federation_profile_from_hcard_with_image_url, parent: :federation_profile_from_hcard do
|
||||
image_url "http://example.com/image.jpg"
|
||||
image_url_medium "http://example.com/image_mid.jpg"
|
||||
image_url_small "http://example.com/image_small.jpg"
|
||||
image_url { "http://example.com/image.jpg" }
|
||||
image_url_medium { "http://example.com/image_mid.jpg" }
|
||||
image_url_small { "http://example.com/image_small.jpg" }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,13 +30,13 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns nil for a remote person" do
|
||||
person = FactoryGirl.create(:person)
|
||||
person = FactoryBot.create(:person)
|
||||
wf = DiasporaFederation.callbacks.trigger(:fetch_person_for_webfinger, person.diaspora_handle)
|
||||
expect(wf).to be_nil
|
||||
end
|
||||
|
||||
it "returns nil for a closed account" do
|
||||
user = FactoryGirl.create(:user)
|
||||
user = FactoryBot.create(:user)
|
||||
user.person.lock_access!
|
||||
wf = DiasporaFederation.callbacks.trigger(:fetch_person_for_webfinger, user.diaspora_handle)
|
||||
expect(wf).to be_nil
|
||||
@@ -61,7 +61,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "trims the full_name" do
|
||||
user = FactoryGirl.create(:user)
|
||||
user = FactoryBot.create(:user)
|
||||
user.person.profile.last_name = nil
|
||||
user.person.profile.save
|
||||
|
||||
@@ -75,13 +75,13 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns nil for a remote person" do
|
||||
person = FactoryGirl.create(:person)
|
||||
person = FactoryBot.create(:person)
|
||||
hcard = DiasporaFederation.callbacks.trigger(:fetch_person_for_hcard, person.guid)
|
||||
expect(hcard).to be_nil
|
||||
end
|
||||
|
||||
it "returns nil for a closed account" do
|
||||
user = FactoryGirl.create(:user)
|
||||
user = FactoryBot.create(:user)
|
||||
user.person.lock_access!
|
||||
hcard = DiasporaFederation.callbacks.trigger(:fetch_person_for_hcard, user.guid)
|
||||
expect(hcard).to be_nil
|
||||
@@ -91,7 +91,7 @@ describe "diaspora federation callbacks" do
|
||||
describe ":save_person_after_webfinger" do
|
||||
context "new person" do
|
||||
it "creates a new person" do
|
||||
person = DiasporaFederation::Entities::Person.new(FactoryGirl.attributes_for(:federation_person_from_webfinger))
|
||||
person = DiasporaFederation::Entities::Person.new(FactoryBot.attributes_for(:federation_person_from_webfinger))
|
||||
|
||||
DiasporaFederation.callbacks.trigger(:save_person_after_webfinger, person)
|
||||
|
||||
@@ -112,10 +112,10 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
it "creates a new person with images" do
|
||||
person = DiasporaFederation::Entities::Person.new(
|
||||
FactoryGirl.attributes_for(
|
||||
FactoryBot.attributes_for(
|
||||
:federation_person_from_webfinger,
|
||||
profile: DiasporaFederation::Entities::Profile.new(
|
||||
FactoryGirl.attributes_for(:federation_profile_from_hcard_with_image_url)
|
||||
FactoryBot.attributes_for(:federation_profile_from_hcard_with_image_url)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -138,7 +138,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "raises an error if a person with the same GUID already exists" do
|
||||
person_data = FactoryGirl.attributes_for(:federation_person_from_webfinger).merge(guid: alice.guid)
|
||||
person_data = FactoryBot.attributes_for(:federation_person_from_webfinger).merge(guid: alice.guid)
|
||||
person = DiasporaFederation::Entities::Person.new(person_data)
|
||||
|
||||
expect {
|
||||
@@ -148,10 +148,10 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
context "update profile" do
|
||||
let(:existing_person_entity) { FactoryGirl.create(:person) }
|
||||
let(:existing_person_entity) { FactoryBot.create(:person) }
|
||||
let(:person) {
|
||||
DiasporaFederation::Entities::Person.new(
|
||||
FactoryGirl.attributes_for(:federation_person_from_webfinger,
|
||||
FactoryBot.attributes_for(:federation_person_from_webfinger,
|
||||
diaspora_id: existing_person_entity.diaspora_handle)
|
||||
)
|
||||
}
|
||||
@@ -192,8 +192,8 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
end
|
||||
|
||||
let(:local_person) { FactoryGirl.create(:user).person }
|
||||
let(:remote_person) { FactoryGirl.create(:person) }
|
||||
let(:local_person) { FactoryBot.create(:user).person }
|
||||
let(:remote_person) { FactoryBot.create(:person) }
|
||||
|
||||
describe ":fetch_private_key" do
|
||||
it "returns a private key for a local user" do
|
||||
@@ -223,7 +223,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "fetches an unknown user" do
|
||||
person = FactoryGirl.build(:person)
|
||||
person = FactoryBot.build(:person)
|
||||
expect(Person).to receive(:find_or_fetch_by_identifier).with(person.diaspora_handle).and_return(person)
|
||||
|
||||
key = DiasporaFederation.callbacks.trigger(:fetch_public_key, person.diaspora_handle)
|
||||
@@ -244,7 +244,7 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
describe ":fetch_related_entity" do
|
||||
it "returns related entity for an existing local post" do
|
||||
post = FactoryGirl.create(:status_message, author: local_person)
|
||||
post = FactoryBot.create(:status_message, author: local_person)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_related_entity, "Post", post.guid)
|
||||
expect(entity.author).to eq(post.diaspora_handle)
|
||||
expect(entity.local).to be_truthy
|
||||
@@ -253,7 +253,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns related entity for an existing remote post" do
|
||||
post = FactoryGirl.create(:status_message, author: remote_person)
|
||||
post = FactoryBot.create(:status_message, author: remote_person)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_related_entity, "Post", post.guid)
|
||||
expect(entity.author).to eq(post.diaspora_handle)
|
||||
expect(entity.local).to be_falsey
|
||||
@@ -262,7 +262,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns related entity for an existing public post" do
|
||||
post = FactoryGirl.create(:status_message, author: local_person, public: true)
|
||||
post = FactoryBot.create(:status_message, author: local_person, public: true)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_related_entity, "Post", post.guid)
|
||||
expect(entity.author).to eq(post.diaspora_handle)
|
||||
expect(entity.local).to be_truthy
|
||||
@@ -271,8 +271,8 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns related entity for an existing comment" do
|
||||
post = FactoryGirl.create(:status_message, author: local_person, public: true)
|
||||
comment = FactoryGirl.create(:comment, author: remote_person, parent: post)
|
||||
post = FactoryBot.create(:status_message, author: local_person, public: true)
|
||||
comment = FactoryBot.create(:comment, author: remote_person, parent: post)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_related_entity, "Comment", comment.guid)
|
||||
expect(entity.author).to eq(comment.diaspora_handle)
|
||||
expect(entity.local).to be_falsey
|
||||
@@ -284,7 +284,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns related entity for an existing conversation" do
|
||||
conversation = FactoryGirl.create(:conversation, author: local_person)
|
||||
conversation = FactoryBot.create(:conversation, author: local_person)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_related_entity, "Conversation", conversation.guid)
|
||||
expect(entity.author).to eq(local_person.diaspora_handle)
|
||||
expect(entity.local).to be_truthy
|
||||
@@ -331,7 +331,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "returns false if the no user is found" do
|
||||
person = FactoryGirl.create(:person)
|
||||
person = FactoryBot.create(:person)
|
||||
result = DiasporaFederation.callbacks.trigger(:queue_private_receive, person.guid, data, true)
|
||||
expect(result).to be_falsey
|
||||
end
|
||||
@@ -363,7 +363,7 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
it "receives a entity" do
|
||||
received = Fabricate(:status_message_entity, author: remote_person.diaspora_handle)
|
||||
persisted = FactoryGirl.create(:status_message)
|
||||
persisted = FactoryBot.create(:status_message)
|
||||
|
||||
expect(Diaspora::Federation::Receive).to receive(:perform).with(received).and_return(persisted)
|
||||
expect(Workers::ReceiveLocal).to receive(:perform_async).with(persisted.class.to_s, persisted.id, [])
|
||||
@@ -373,7 +373,7 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
it "calls schedule_check_if_needed on the senders pod" do
|
||||
received = Fabricate(:status_message_entity, author: remote_person.diaspora_handle)
|
||||
persisted = FactoryGirl.create(:status_message)
|
||||
persisted = FactoryBot.create(:status_message)
|
||||
|
||||
expect(Person).to receive(:by_account_identifier).with(received.author).and_return(remote_person)
|
||||
expect(remote_person.pod).to receive(:schedule_check_if_needed)
|
||||
@@ -385,7 +385,7 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
it "receives a entity for a recipient" do
|
||||
received = Fabricate(:status_message_entity, author: remote_person.diaspora_handle)
|
||||
persisted = FactoryGirl.create(:status_message)
|
||||
persisted = FactoryBot.create(:status_message)
|
||||
|
||||
expect(Diaspora::Federation::Receive).to receive(:perform).with(received).and_return(persisted)
|
||||
expect(Workers::ReceiveLocal).to receive(:perform_async).with(persisted.class.to_s, persisted.id, [42])
|
||||
@@ -405,7 +405,7 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
describe ":fetch_public_entity" do
|
||||
it "fetches a Post" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: true)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_public_entity, "Post", post.guid)
|
||||
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
@@ -414,7 +414,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "fetches a StatusMessage" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: true)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_public_entity, "StatusMessage", post.guid)
|
||||
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
@@ -423,7 +423,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "fetches a Reshare" do
|
||||
post = FactoryGirl.create(:reshare, author: alice.person, public: true)
|
||||
post = FactoryBot.create(:reshare, author: alice.person, public: true)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_public_entity, "Reshare", post.guid)
|
||||
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
@@ -431,8 +431,8 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "fetches a StatusMessage by a Poll guid" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
poll = FactoryGirl.create(:poll, status_message: post)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: true)
|
||||
poll = FactoryBot.create(:poll, status_message: post)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_public_entity, "Poll", poll.guid)
|
||||
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
@@ -443,15 +443,15 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "doesn't fetch a private StatusMessage by a Poll guid" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: false)
|
||||
poll = FactoryGirl.create(:poll, status_message: post)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: false)
|
||||
poll = FactoryBot.create(:poll, status_message: post)
|
||||
expect(
|
||||
DiasporaFederation.callbacks.trigger(:fetch_public_entity, "Poll", poll.guid)
|
||||
).to be_nil
|
||||
end
|
||||
|
||||
it "does not fetch a private post" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: false)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: false)
|
||||
|
||||
expect(
|
||||
DiasporaFederation.callbacks.trigger(:fetch_public_entity, "StatusMessage", post.guid)
|
||||
@@ -467,8 +467,8 @@ describe "diaspora federation callbacks" do
|
||||
|
||||
describe ":fetch_person_url_to" do
|
||||
it "returns the url with with the pod of the person" do
|
||||
pod = FactoryGirl.create(:pod)
|
||||
person = FactoryGirl.create(:person, pod: pod)
|
||||
pod = FactoryBot.create(:pod)
|
||||
person = FactoryBot.create(:person, pod: pod)
|
||||
|
||||
expect(
|
||||
DiasporaFederation.callbacks.trigger(:fetch_person_url_to, person.diaspora_handle, "/path/on/pod")
|
||||
@@ -476,8 +476,8 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "fetches an unknown user" do
|
||||
pod = FactoryGirl.build(:pod)
|
||||
person = FactoryGirl.build(:person, pod: pod)
|
||||
pod = FactoryBot.build(:pod)
|
||||
person = FactoryBot.build(:person, pod: pod)
|
||||
expect(Person).to receive(:find_or_fetch_by_identifier).with(person.diaspora_handle).and_return(person)
|
||||
|
||||
expect(
|
||||
@@ -497,11 +497,11 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
describe ":update_pod" do
|
||||
let(:pod) { FactoryGirl.create(:pod) }
|
||||
let(:pod) { FactoryBot.create(:pod) }
|
||||
let(:pod_url) { pod.url_to("/") }
|
||||
|
||||
it "sets the correct error for curl-errors" do
|
||||
pod = FactoryGirl.create(:pod)
|
||||
pod = FactoryBot.create(:pod)
|
||||
|
||||
DiasporaFederation.callbacks.trigger(:update_pod, pod.url_to("/"), :ssl_cacert)
|
||||
|
||||
@@ -511,7 +511,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "sets :no_errors to a pod that was down but up now and return code 202" do
|
||||
pod = FactoryGirl.create(:pod, status: :unknown_error)
|
||||
pod = FactoryBot.create(:pod, status: :unknown_error)
|
||||
|
||||
DiasporaFederation.callbacks.trigger(:update_pod, pod.url_to("/"), 202)
|
||||
|
||||
@@ -520,7 +520,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "does not change a pod that has status :version_failed and was successful" do
|
||||
pod = FactoryGirl.create(:pod, status: :version_failed)
|
||||
pod = FactoryBot.create(:pod, status: :version_failed)
|
||||
|
||||
DiasporaFederation.callbacks.trigger(:update_pod, pod.url_to("/"), 202)
|
||||
|
||||
@@ -529,7 +529,7 @@ describe "diaspora federation callbacks" do
|
||||
end
|
||||
|
||||
it "sets :http_failed if it has an unsuccessful http status code" do
|
||||
pod = FactoryGirl.create(:pod)
|
||||
pod = FactoryBot.create(:pod)
|
||||
|
||||
DiasporaFederation.callbacks.trigger(:update_pod, pod.url_to("/"), 404)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
describe ApplicationHelper, :type => :helper do
|
||||
before do
|
||||
@user = alice
|
||||
@person = FactoryGirl.create(:person)
|
||||
@person = FactoryBot.create(:person)
|
||||
end
|
||||
|
||||
describe "#all_services_connected?" do
|
||||
@@ -25,7 +25,7 @@ describe ApplicationHelper, :type => :helper do
|
||||
end
|
||||
|
||||
it 'returns true if all networks are connected' do
|
||||
3.times { |t| @current_user.services << FactoryGirl.build(:service) }
|
||||
3.times { |t| @current_user.services << FactoryBot.build(:service) }
|
||||
expect(all_services_connected?).to be true
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@ describe ApplicationHelper, :type => :helper do
|
||||
end
|
||||
|
||||
it "returns false if the service is already connected" do
|
||||
@current_user.services << FactoryGirl.build(:service, provider: "service")
|
||||
@current_user.services << FactoryBot.build(:service, provider: "service")
|
||||
expect(AppConfig).to receive(:show_service?).with("service", alice).and_return(true)
|
||||
expect(service_unconnected?("service")).to be false
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
describe ConversationsHelper, :type => :helper do
|
||||
before do
|
||||
@conversation = FactoryGirl.create(:conversation)
|
||||
@conversation = FactoryBot.create(:conversation)
|
||||
end
|
||||
|
||||
describe '#conversation_class' do
|
||||
|
||||
@@ -4,9 +4,9 @@ describe GonHelper, type: :helper do
|
||||
include_context :gon
|
||||
|
||||
describe "#gon_load_contact" do
|
||||
let(:contact) { FactoryGirl.build(:contact) }
|
||||
let(:contact) { FactoryBot.build(:contact) }
|
||||
let(:current_user) { contact.user }
|
||||
let(:another_contact) { FactoryGirl.build(:contact, user: current_user) }
|
||||
let(:another_contact) { FactoryBot.build(:contact, user: current_user) }
|
||||
|
||||
before do
|
||||
RequestStore.store[:gon] = Gon::Request.new(controller.request.env)
|
||||
|
||||
@@ -4,12 +4,12 @@ describe NotificationsHelper, type: :helper do
|
||||
include ApplicationHelper
|
||||
|
||||
before do
|
||||
@user = FactoryGirl.create(:user)
|
||||
@person = FactoryGirl.create(:person)
|
||||
@post = FactoryGirl.create(:status_message, author: @user.person)
|
||||
@person2 = FactoryGirl.create(:person)
|
||||
Notifications::Liked.notify(FactoryGirl.create(:like, author: @person, target: @post), [])
|
||||
Notifications::Liked.notify(FactoryGirl.create(:like, author: @person2, target: @post), [])
|
||||
@user = FactoryBot.create(:user)
|
||||
@person = FactoryBot.create(:person)
|
||||
@post = FactoryBot.create(:status_message, author: @user.person)
|
||||
@person2 = FactoryBot.create(:person)
|
||||
Notifications::Liked.notify(FactoryBot.create(:like, author: @person, target: @post), [])
|
||||
Notifications::Liked.notify(FactoryBot.create(:like, author: @person2, target: @post), [])
|
||||
|
||||
@notification = Notifications::Liked.find_by(target: @post, recipient: @user)
|
||||
end
|
||||
@@ -20,19 +20,19 @@ describe NotificationsHelper, type: :helper do
|
||||
let(:output){ strip_tags(notification_people_link(@note)) }
|
||||
|
||||
before do
|
||||
@max = FactoryGirl.create(:person)
|
||||
@max = FactoryBot.create(:person)
|
||||
@max.profile.first_name = 'max'
|
||||
@max.profile.last_name = 'salzberg'
|
||||
@sarah = FactoryGirl.create(:person)
|
||||
@sarah = FactoryBot.create(:person)
|
||||
@sarah.profile.first_name = 'sarah'
|
||||
@sarah.profile.last_name = 'mei'
|
||||
|
||||
|
||||
@daniel = FactoryGirl.create(:person)
|
||||
@daniel = FactoryBot.create(:person)
|
||||
@daniel.profile.first_name = 'daniel'
|
||||
@daniel.profile.last_name = 'grippi'
|
||||
|
||||
@ilya = FactoryGirl.create(:person)
|
||||
@ilya = FactoryBot.create(:person)
|
||||
@ilya.profile.first_name = 'ilya'
|
||||
@ilya.profile.last_name = 'zhit'
|
||||
@note = double()
|
||||
@@ -94,7 +94,7 @@ describe NotificationsHelper, type: :helper do
|
||||
end
|
||||
|
||||
let(:status_message) {
|
||||
FactoryGirl.create(:status_message_in_aspect, author: alice.person, text: text_mentioning(bob))
|
||||
FactoryBot.create(:status_message_in_aspect, author: alice.person, text: text_mentioning(bob))
|
||||
}
|
||||
|
||||
describe "when mentioned in status message" do
|
||||
@@ -111,7 +111,7 @@ describe NotificationsHelper, type: :helper do
|
||||
|
||||
describe "when mentioned in comment" do
|
||||
it "should include correct wording, post link and comment link" do
|
||||
comment = FactoryGirl.create(:comment, author: bob.person, text: text_mentioning(alice), post: status_message)
|
||||
comment = FactoryBot.create(:comment, author: bob.person, text: text_mentioning(alice), post: status_message)
|
||||
Notifications::MentionedInComment.notify(comment, [alice.id])
|
||||
notification = Notifications::MentionedInComment.last
|
||||
expect(notification).not_to be_nil
|
||||
|
||||
@@ -8,7 +8,7 @@ describe NotifierHelper, :type => :helper do
|
||||
describe '#post_message' do
|
||||
before do
|
||||
# post for markdown test
|
||||
@markdown_post = FactoryGirl.create(:status_message,
|
||||
@markdown_post = FactoryBot.create(:status_message,
|
||||
text: "[link](http://diasporafoundation.org) **bold text** *other text*", public: true)
|
||||
@striped_markdown_post = "link (http://diasporafoundation.org) bold text other text"
|
||||
end
|
||||
@@ -18,14 +18,14 @@ describe NotifierHelper, :type => :helper do
|
||||
end
|
||||
|
||||
it "falls back to the title if the post has no text" do
|
||||
photo = FactoryGirl.build(:photo, public: true)
|
||||
photo_post = FactoryGirl.build(:status_message, author: photo.author, text: "", photos: [photo], public: true)
|
||||
photo = FactoryBot.build(:photo, public: true)
|
||||
photo_post = FactoryBot.build(:status_message, author: photo.author, text: "", photos: [photo], public: true)
|
||||
expect(helper.post_message(photo_post))
|
||||
.to eq(I18n.t("posts.show.photos_by", count: 1, author: photo_post.author_name))
|
||||
end
|
||||
|
||||
it "falls back to the title, if the root post was deleted" do
|
||||
reshare = FactoryGirl.create(:reshare)
|
||||
reshare = FactoryBot.create(:reshare)
|
||||
reshare.root.destroy
|
||||
expect(helper.post_message(Reshare.find(reshare.id)))
|
||||
.to eq(I18n.t("posts.show.reshare_by", author: reshare.author_name))
|
||||
@@ -35,13 +35,13 @@ describe NotifierHelper, :type => :helper do
|
||||
describe '#comment_message' do
|
||||
before do
|
||||
# comment for markdown test
|
||||
@markdown_comment = FactoryGirl.create(:comment)
|
||||
@markdown_comment = FactoryBot.create(:comment)
|
||||
@markdown_comment.post.public = true
|
||||
@markdown_comment.text = "[link](http://diasporafoundation.org) **bold text** *other text*"
|
||||
@striped_markdown_comment = "link (http://diasporafoundation.org) bold text other text"
|
||||
|
||||
# comment for limited post
|
||||
@limited_comment = FactoryGirl.create(:comment)
|
||||
@limited_comment = FactoryBot.create(:comment)
|
||||
@limited_comment.post.public = false
|
||||
@limited_comment.text = "This is top secret comment. Shhhhhhhh!!!"
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
describe PeopleHelper, :type => :helper do
|
||||
before do
|
||||
@user = alice
|
||||
@person = FactoryGirl.create(:person)
|
||||
@person = FactoryBot.create(:person)
|
||||
end
|
||||
|
||||
describe "#birthday_format" do
|
||||
@@ -47,7 +47,7 @@ describe PeopleHelper, :type => :helper do
|
||||
|
||||
describe '#person_link' do
|
||||
before do
|
||||
@person = FactoryGirl.create(:person)
|
||||
@person = FactoryBot.create(:person)
|
||||
end
|
||||
|
||||
it 'includes the name of the person if they have a first name' do
|
||||
@@ -86,7 +86,7 @@ describe PeopleHelper, :type => :helper do
|
||||
|
||||
describe '#local_or_remote_person_path' do
|
||||
before do
|
||||
@user = FactoryGirl.create(:user)
|
||||
@user = FactoryBot.create(:user)
|
||||
end
|
||||
|
||||
it "links by id if there is a period in the user's username" do
|
||||
|
||||
@@ -8,7 +8,7 @@ describe PostsHelper, :type => :helper do
|
||||
|
||||
describe '#post_page_title' do
|
||||
before do
|
||||
@sm = FactoryGirl.create(:status_message)
|
||||
@sm = FactoryBot.create(:status_message)
|
||||
end
|
||||
|
||||
context 'with posts with text' do
|
||||
@@ -22,7 +22,7 @@ describe PostsHelper, :type => :helper do
|
||||
|
||||
context "with a reshare" do
|
||||
it "returns 'Reshare by...'" do
|
||||
reshare = FactoryGirl.create(:reshare, author: alice.person)
|
||||
reshare = FactoryBot.create(:reshare, author: alice.person)
|
||||
expect(post_page_title(reshare)).to eq I18n.t("posts.show.reshare_by", author: reshare.author_name)
|
||||
end
|
||||
end
|
||||
@@ -31,7 +31,7 @@ describe PostsHelper, :type => :helper do
|
||||
|
||||
describe '#post_iframe_url' do
|
||||
before do
|
||||
@post = FactoryGirl.create(:status_message)
|
||||
@post = FactoryBot.create(:status_message)
|
||||
end
|
||||
|
||||
it "returns an iframe tag" do
|
||||
|
||||
@@ -7,7 +7,7 @@ describe "deleteing account", type: :request do
|
||||
end
|
||||
|
||||
context "of local user" do
|
||||
subject(:user) { FactoryGirl.create(:user_with_aspect) }
|
||||
subject(:user) { FactoryBot.create(:user_with_aspect) }
|
||||
let(:person) { user.person }
|
||||
|
||||
before do
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
require "integration/federation/federation_helper"
|
||||
|
||||
def create_remote_contact(user, pod_host)
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:contact,
|
||||
user: user,
|
||||
person: FactoryGirl.create(
|
||||
person: FactoryBot.create(
|
||||
:person,
|
||||
pod: Pod.find_or_create_by(url: "http://#{pod_host}"),
|
||||
diaspora_handle: "#{r_str}@#{pod_host}"
|
||||
@@ -16,29 +16,29 @@ end
|
||||
|
||||
shared_examples_for "every migration scenario" do
|
||||
it "updates person references" do
|
||||
contact = FactoryGirl.create(:contact, person: old_person)
|
||||
post = FactoryGirl.create(:status_message, author: old_person)
|
||||
reshare = FactoryGirl.create(:reshare, author: old_person)
|
||||
photo = FactoryGirl.create(:photo, author: old_person)
|
||||
comment = FactoryGirl.create(:comment, author: old_person)
|
||||
like = FactoryGirl.create(:like, author: old_person)
|
||||
participation = FactoryGirl.create(:participation, author: old_person)
|
||||
poll_participation = FactoryGirl.create(:poll_participation, author: old_person)
|
||||
mention = FactoryGirl.create(:mention, person: old_person)
|
||||
message = FactoryGirl.create(:message, author: old_person)
|
||||
conversation = FactoryGirl.create(:conversation, author: old_person)
|
||||
block = FactoryGirl.create(:user).blocks.create(person: old_person)
|
||||
role = FactoryGirl.create(:role, person: old_person)
|
||||
contact = FactoryBot.create(:contact, person: old_person)
|
||||
post = FactoryBot.create(:status_message, author: old_person)
|
||||
reshare = FactoryBot.create(:reshare, author: old_person)
|
||||
photo = FactoryBot.create(:photo, author: old_person)
|
||||
comment = FactoryBot.create(:comment, author: old_person)
|
||||
like = FactoryBot.create(:like, author: old_person)
|
||||
participation = FactoryBot.create(:participation, author: old_person)
|
||||
poll_participation = FactoryBot.create(:poll_participation, author: old_person)
|
||||
mention = FactoryBot.create(:mention, person: old_person)
|
||||
message = FactoryBot.create(:message, author: old_person)
|
||||
conversation = FactoryBot.create(:conversation, author: old_person)
|
||||
block = FactoryBot.create(:user).blocks.create(person: old_person)
|
||||
role = FactoryBot.create(:role, person: old_person)
|
||||
|
||||
# Create ConversationVisibility by creating a conversation with participants
|
||||
conversation2 = FactoryGirl.build(:conversation)
|
||||
FactoryGirl.create(:contact, user: old_user, person: conversation2.author) if old_person.local?
|
||||
conversation2 = FactoryBot.build(:conversation)
|
||||
FactoryBot.create(:contact, user: old_user, person: conversation2.author) if old_person.local?
|
||||
conversation2.participants << old_person
|
||||
conversation2.save!
|
||||
visibility = ConversationVisibility.find_by(person_id: old_person.id)
|
||||
|
||||
# In order to create a notification actor we need to create a notification first
|
||||
notification = FactoryGirl.build(:notification)
|
||||
notification = FactoryBot.build(:notification)
|
||||
notification.actors << old_person
|
||||
notification.save!
|
||||
actor = notification.notification_actors.find_by(person_id: old_person.id)
|
||||
@@ -110,7 +110,7 @@ end
|
||||
shared_examples_for "migration scenarios initiated remotely" do
|
||||
it "resends known contacts to the new user" do
|
||||
2.times do
|
||||
contact = FactoryGirl.create(:contact, person: old_user.person, sharing: true)
|
||||
contact = FactoryBot.create(:contact, person: old_user.person, sharing: true)
|
||||
expect(DiasporaFederation::Federation::Sender).to receive(:private)
|
||||
.with(
|
||||
contact.user_id,
|
||||
@@ -157,17 +157,17 @@ end
|
||||
|
||||
shared_examples_for "migration scenarios with local user rename" do
|
||||
it "updates user references" do
|
||||
invited_user = FactoryGirl.create(:user, invited_by: old_user)
|
||||
aspect = FactoryGirl.create(:aspect, user: old_user, name: r_str)
|
||||
contact = FactoryGirl.create(:contact, user: old_user)
|
||||
service = FactoryGirl.create(:service, user: old_user)
|
||||
invited_user = FactoryBot.create(:user, invited_by: old_user)
|
||||
aspect = FactoryBot.create(:aspect, user: old_user, name: r_str)
|
||||
contact = FactoryBot.create(:contact, user: old_user)
|
||||
service = FactoryBot.create(:service, user: old_user)
|
||||
pref = UserPreference.create!(user: old_user, email_type: "also_commented")
|
||||
tag_following = FactoryGirl.create(:tag_following, user: old_user)
|
||||
block = FactoryGirl.create(:block, user: old_user)
|
||||
notification = FactoryGirl.create(:notification, recipient: old_user)
|
||||
report = FactoryGirl.create(:report, user: old_user)
|
||||
authorization = FactoryGirl.create(:auth_with_read_scopes, user: old_user)
|
||||
share_visibility = FactoryGirl.create(:share_visibility, user: old_user)
|
||||
tag_following = FactoryBot.create(:tag_following, user: old_user)
|
||||
block = FactoryBot.create(:block, user: old_user)
|
||||
notification = FactoryBot.create(:notification, recipient: old_user)
|
||||
report = FactoryBot.create(:report, user: old_user)
|
||||
authorization = FactoryBot.create(:auth_with_read_scopes, user: old_user)
|
||||
share_visibility = FactoryBot.create(:share_visibility, user: old_user)
|
||||
|
||||
run_migration
|
||||
|
||||
@@ -229,7 +229,7 @@ describe "account migration" do
|
||||
|
||||
# this is the case when we're a pod, which was left by a person in favor of remote one
|
||||
context "old user is local, new user is remote" do
|
||||
let(:old_user) { FactoryGirl.create(:user) }
|
||||
let(:old_user) { FactoryBot.create(:user) }
|
||||
let(:old_person) { old_user.person }
|
||||
let(:new_user) { remote_user_on_pod_b }
|
||||
let(:new_person) { new_user.person }
|
||||
@@ -282,7 +282,7 @@ describe "account migration" do
|
||||
context "old user is remote and new user is local" do
|
||||
let(:old_user) { remote_user_on_pod_c }
|
||||
let(:old_person) { old_user.person }
|
||||
let(:new_user) { FactoryGirl.create(:user) }
|
||||
let(:new_user) { FactoryBot.create(:user) }
|
||||
let(:new_person) { new_user.person }
|
||||
|
||||
def run_migration
|
||||
@@ -300,7 +300,7 @@ describe "account migration" do
|
||||
end
|
||||
|
||||
context "when new person has been migrated before" do
|
||||
let(:intermidiate_person) { FactoryGirl.create(:user).person }
|
||||
let(:intermidiate_person) { FactoryBot.create(:user).person }
|
||||
|
||||
before do
|
||||
AccountMigration.create!(old_person: intermidiate_person, new_person: new_person).perform!
|
||||
@@ -320,9 +320,9 @@ describe "account migration" do
|
||||
|
||||
# this is the case when a user changes diaspora id but stays on the same pod
|
||||
context "old user is local and new user is local" do
|
||||
let(:old_user) { FactoryGirl.create(:user) }
|
||||
let(:old_user) { FactoryBot.create(:user) }
|
||||
let(:old_person) { old_user.person }
|
||||
let(:new_user) { FactoryGirl.create(:user) }
|
||||
let(:new_user) { FactoryBot.create(:user) }
|
||||
let(:new_person) { new_user.person }
|
||||
|
||||
def run_migration
|
||||
@@ -345,7 +345,7 @@ describe "account migration" do
|
||||
include_examples "migration scenarios with local user rename"
|
||||
|
||||
context "when new user has been migrated before" do
|
||||
let(:intermidiate_person) { FactoryGirl.create(:user).person }
|
||||
let(:intermidiate_person) { FactoryBot.create(:user).person }
|
||||
|
||||
before do
|
||||
AccountMigration.create!(old_person: intermidiate_person, new_person: new_person).perform!
|
||||
|
||||
@@ -4,21 +4,21 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::AspectsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid contacts:read contacts:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid contacts:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
|
||||
@@ -4,22 +4,22 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::CommentsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify private:read interactions],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify interactions]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
@@ -28,8 +28,8 @@ describe Api::V1::CommentsController do
|
||||
let(:invalid_token) { SecureRandom.hex(9) }
|
||||
|
||||
before do
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
eve.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
eve.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
|
||||
@status = alice.post(
|
||||
"Post",
|
||||
|
||||
@@ -4,21 +4,21 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::ContactsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid contacts:read contacts:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid contacts:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
@@ -31,7 +31,7 @@ describe Api::V1::ContactsController do
|
||||
auth.user.share_with(eve.person, @aspect1)
|
||||
@aspect2 = auth.user.aspects.create(name: "another aspect")
|
||||
@eve_aspect = eve.aspects.first
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
end
|
||||
|
||||
describe "#show" do
|
||||
|
||||
@@ -4,19 +4,19 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::ConversationsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid conversations],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_participant) {
|
||||
FactoryGirl.create(:auth_with_all_scopes)
|
||||
FactoryBot.create(:auth_with_all_scopes)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
@@ -25,7 +25,7 @@ describe Api::V1::ConversationsController do
|
||||
let(:invalid_token) { SecureRandom.hex(9) }
|
||||
|
||||
before do
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
|
||||
auth.user.aspects.create(name: "first")
|
||||
auth.user.share_with(alice.person, auth.user.aspects[0])
|
||||
|
||||
@@ -4,22 +4,22 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::LikesController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify private:read private:modify interactions],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify interactions]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
@@ -28,8 +28,8 @@ describe Api::V1::LikesController do
|
||||
let(:invalid_token) { SecureRandom.hex(9) }
|
||||
|
||||
before do
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
bob.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
bob.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
|
||||
@status = auth.user.post(
|
||||
:status_message,
|
||||
|
||||
@@ -4,15 +4,15 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::MessagesController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid conversations],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
|
||||
@@ -4,11 +4,11 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::NotificationsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(:auth_with_all_scopes)
|
||||
FactoryBot.create(:auth_with_all_scopes)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
@@ -25,8 +25,8 @@ describe Api::V1::NotificationsController do
|
||||
:status_message,
|
||||
text: "This is a status message mentioning @{#{auth.user.diaspora_handle}}"
|
||||
)
|
||||
@notification = FactoryGirl.create(:notification, recipient: auth.user, target: @post, created_at: 1.hour.ago)
|
||||
@mentioned = FactoryGirl.create(:notification_mentioned_in_comment, recipient: auth.user, target: @post)
|
||||
@notification = FactoryBot.create(:notification, recipient: auth.user, target: @post, created_at: 1.hour.ago)
|
||||
@mentioned = FactoryBot.create(:notification_mentioned_in_comment, recipient: auth.user, target: @post)
|
||||
end
|
||||
|
||||
describe "#index" do
|
||||
@@ -153,7 +153,7 @@ describe Api::V1::NotificationsController do
|
||||
public: true,
|
||||
to: "all"
|
||||
)
|
||||
alice_notification = FactoryGirl.create(:notification, recipient: alice, target: alice_post)
|
||||
alice_notification = FactoryBot.create(:notification, recipient: alice, target: alice_post)
|
||||
|
||||
get(
|
||||
api_v1_notification_path(alice_notification.guid),
|
||||
|
||||
@@ -4,35 +4,35 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::PhotosController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify private:read private:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read private:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
|
||||
@@ -4,21 +4,21 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::PostInteractionsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify private:read private:modify interactions]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify interactions]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
|
||||
@@ -4,35 +4,35 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::PostsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify private:read private:modify],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read private:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) { FactoryGirl.create(:auth_with_default_scopes) }
|
||||
let(:auth_minimum_scopes) { FactoryBot.create(:auth_with_default_scopes) }
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
let!(:access_token_public_only) { auth_public_only.create_access_token.to_s }
|
||||
let!(:access_token_read_only) { auth_read_only.create_access_token.to_s }
|
||||
@@ -41,9 +41,9 @@ describe Api::V1::PostsController do
|
||||
let(:invalid_token) { SecureRandom.hex(9) }
|
||||
|
||||
before do
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
bob.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
eve.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
bob.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
eve.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
|
||||
@alice_aspect = alice.aspects.first
|
||||
@alice_photo1 = alice.post(:photo, pending: true, user_file: File.open(photo_fixture_name), to: @alice_aspect.id)
|
||||
@@ -87,8 +87,8 @@ describe Api::V1::PostsController do
|
||||
merged_params = merged_params.merge(poll_params)
|
||||
merged_params = merged_params.merge(photos: @alice_photo_ids)
|
||||
status_message = StatusMessageCreationService.new(alice).create(merged_params)
|
||||
status_message.open_graph_cache = FactoryGirl.create(:open_graph_cache, video_url: "http://example.org")
|
||||
status_message.o_embed_cache = FactoryGirl.create(:o_embed_cache)
|
||||
status_message.open_graph_cache = FactoryBot.create(:open_graph_cache, video_url: "http://example.org")
|
||||
status_message.o_embed_cache = FactoryBot.create(:o_embed_cache)
|
||||
status_message.save
|
||||
|
||||
get(
|
||||
@@ -132,7 +132,7 @@ describe Api::V1::PostsController do
|
||||
|
||||
context "access reshare style post by post ID" do
|
||||
it "gets post" do
|
||||
reshare_post = FactoryGirl.create(:reshare, root: @status, author: bob.person)
|
||||
reshare_post = FactoryBot.create(:reshare, root: @status, author: bob.person)
|
||||
get(
|
||||
api_v1_post_path(reshare_post.guid),
|
||||
params: {
|
||||
|
||||
@@ -4,15 +4,15 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::ResharesController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(:auth_with_all_scopes)
|
||||
FactoryBot.create(:auth_with_all_scopes)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(:auth_with_read_scopes)
|
||||
FactoryBot.create(:auth_with_read_scopes)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
@@ -21,7 +21,7 @@ describe Api::V1::ResharesController do
|
||||
let(:invalid_token) { SecureRandom.hex(9) }
|
||||
|
||||
before do
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
|
||||
@user_post = auth.user.post(
|
||||
:status_message,
|
||||
|
||||
@@ -4,21 +4,21 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::SearchController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify private:read contacts:read private:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read private:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read]
|
||||
)
|
||||
@@ -31,21 +31,21 @@ describe Api::V1::SearchController do
|
||||
|
||||
describe "#user_index" do
|
||||
before do
|
||||
@searchable_user = FactoryGirl.create(
|
||||
@searchable_user = FactoryBot.create(
|
||||
:person,
|
||||
diaspora_handle: "findable@example.org",
|
||||
profile: FactoryGirl.build(:profile, first_name: "Terry", last_name: "Smith")
|
||||
profile: FactoryBot.build(:profile, first_name: "Terry", last_name: "Smith")
|
||||
)
|
||||
|
||||
@closed_user = FactoryGirl.create(
|
||||
@closed_user = FactoryBot.create(
|
||||
:person,
|
||||
closed_account: true,
|
||||
profile: FactoryGirl.build(:profile, first_name: "Closed", last_name: "Account")
|
||||
profile: FactoryBot.build(:profile, first_name: "Closed", last_name: "Account")
|
||||
)
|
||||
@unsearchable_user = FactoryGirl.create(
|
||||
@unsearchable_user = FactoryBot.create(
|
||||
:person,
|
||||
diaspora_handle: "unsearchable@example.org",
|
||||
profile: FactoryGirl.build(
|
||||
profile: FactoryBot.build(
|
||||
:profile,
|
||||
first_name: "Unsearchable",
|
||||
last_name: "Person",
|
||||
@@ -57,9 +57,9 @@ describe Api::V1::SearchController do
|
||||
it "succeeds by tag" do
|
||||
tag = SecureRandom.hex(5)
|
||||
5.times do
|
||||
FactoryGirl.create(:person, profile: FactoryGirl.build(:profile, tag_string: "##{tag}"))
|
||||
FactoryBot.create(:person, profile: FactoryBot.build(:profile, tag_string: "##{tag}"))
|
||||
end
|
||||
FactoryGirl.create(:person, closed_account: true, profile: FactoryGirl.build(:profile, tag_string: "##{tag}"))
|
||||
FactoryBot.create(:person, closed_account: true, profile: FactoryBot.build(:profile, tag_string: "##{tag}"))
|
||||
|
||||
get(
|
||||
"/api/v1/search/users",
|
||||
@@ -202,7 +202,7 @@ describe Api::V1::SearchController do
|
||||
end
|
||||
|
||||
def add_contact(receiving, sharing)
|
||||
other = FactoryGirl.create(:user)
|
||||
other = FactoryBot.create(:user)
|
||||
other.profile.update(first_name: name)
|
||||
|
||||
if receiving
|
||||
@@ -312,7 +312,7 @@ describe Api::V1::SearchController do
|
||||
end
|
||||
|
||||
def add_contact(*aspects)
|
||||
other = FactoryGirl.create(:person, profile: FactoryGirl.build(:profile, first_name: contact_name))
|
||||
other = FactoryBot.create(:person, profile: FactoryBot.build(:profile, first_name: contact_name))
|
||||
aspects.each do |aspect|
|
||||
auth.user.share_with(other, aspect)
|
||||
end
|
||||
@@ -464,9 +464,9 @@ describe Api::V1::SearchController do
|
||||
|
||||
describe "tag_index" do
|
||||
before do
|
||||
FactoryGirl.create(:tag, name: "apipartyone")
|
||||
FactoryGirl.create(:tag, name: "apipartytwo")
|
||||
FactoryGirl.create(:tag, name: "apipartythree")
|
||||
FactoryBot.create(:tag, name: "apipartyone")
|
||||
FactoryBot.create(:tag, name: "apipartytwo")
|
||||
FactoryBot.create(:tag, name: "apipartythree")
|
||||
end
|
||||
|
||||
it "succeeds" do
|
||||
|
||||
@@ -4,26 +4,26 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::StreamsController do
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read private:read contacts:read tags:read],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only_tags) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read tags:read],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read],
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ require_relative "api_spec_helper"
|
||||
|
||||
describe Api::V1::TagFollowingsController do
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid tags:read tags:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid tags:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) { FactoryGirl.create(:auth_with_default_scopes) }
|
||||
let(:auth_minimum_scopes) { FactoryBot.create(:auth_with_default_scopes) }
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
let!(:access_token_read_only) { auth_read_only.create_access_token.to_s }
|
||||
let!(:access_token_minimum_scopes) { auth_minimum_scopes.create_access_token.to_s }
|
||||
|
||||
@@ -4,7 +4,7 @@ describe Api::OpenidConnect::UserInfoController do
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
let!(:auth_with_read_and_ppid) {
|
||||
FactoryGirl.create(:auth_with_profile_and_ppid)
|
||||
FactoryBot.create(:auth_with_profile_and_ppid)
|
||||
}
|
||||
|
||||
let!(:access_token_with_read) { auth_with_read_and_ppid.create_access_token.to_s }
|
||||
|
||||
@@ -11,36 +11,36 @@ describe Api::V1::UsersController do
|
||||
}
|
||||
|
||||
let(:auth) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: full_scopes,
|
||||
user: FactoryGirl.create(:user, profile: FactoryGirl.create(:profile_with_image_url))
|
||||
user: FactoryBot.create(:user, profile: FactoryBot.create(:profile_with_image_url))
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read public:modify]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read private:read contacts:read profile]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_public_only_read_only) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:auth_with_default_scopes,
|
||||
scopes: %w[openid public:read]
|
||||
)
|
||||
}
|
||||
|
||||
let(:auth_minimum_scopes) {
|
||||
FactoryGirl.create(:auth_with_default_scopes)
|
||||
FactoryBot.create(:auth_with_default_scopes)
|
||||
}
|
||||
let!(:access_token) { auth.create_access_token.to_s }
|
||||
let!(:access_token_public_only) { auth_public_only.create_access_token.to_s }
|
||||
@@ -50,7 +50,7 @@ describe Api::V1::UsersController do
|
||||
let(:invalid_token) { SecureRandom.hex(9) }
|
||||
|
||||
before do
|
||||
alice.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
alice.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
end
|
||||
|
||||
describe "#show" do
|
||||
@@ -111,7 +111,7 @@ describe Api::V1::UsersController do
|
||||
end
|
||||
|
||||
it "succeeds with limited data on non-public/not shared" do
|
||||
eve.person.profile = FactoryGirl.create(:profile_with_image_url)
|
||||
eve.person.profile = FactoryBot.create(:profile_with_image_url)
|
||||
eve.profile[:public_details] = false
|
||||
eve.profile.save
|
||||
get(
|
||||
@@ -146,10 +146,10 @@ describe Api::V1::UsersController do
|
||||
end
|
||||
|
||||
it "fails for private profile if don't have contacts:read" do
|
||||
unsearchable_user = FactoryGirl.create(
|
||||
unsearchable_user = FactoryBot.create(
|
||||
:person,
|
||||
diaspora_handle: "unsearchable@example.org",
|
||||
profile: FactoryGirl.build(
|
||||
profile: FactoryBot.build(
|
||||
:profile,
|
||||
first_name: "Unsearchable",
|
||||
last_name: "Person",
|
||||
@@ -511,7 +511,7 @@ describe Api::V1::UsersController do
|
||||
end
|
||||
|
||||
describe "#block" do
|
||||
let(:person) { FactoryGirl.create(:user).person }
|
||||
let(:person) { FactoryBot.create(:user).person }
|
||||
|
||||
context "success" do
|
||||
it "with proper credentials and flags" do
|
||||
|
||||
@@ -6,7 +6,7 @@ def expect_person_fetch(diaspora_id, public_key)
|
||||
expect(instance).to receive(:fetch_and_save) {
|
||||
attributes = {diaspora_handle: diaspora_id}
|
||||
attributes[:serialized_public_key] = public_key if public_key.present?
|
||||
FactoryGirl.create(:person, attributes)
|
||||
FactoryBot.create(:person, attributes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ describe ContactsController, type: :request do
|
||||
end
|
||||
|
||||
context "user has no contacts" do
|
||||
let!(:user) { FactoryGirl.create(:user) }
|
||||
let!(:user) { FactoryBot.create(:user) }
|
||||
|
||||
before do
|
||||
expect(user.contacts.size).to eq(0)
|
||||
@@ -46,11 +46,11 @@ describe ContactsController, type: :request do
|
||||
end
|
||||
|
||||
context "user has contacts" do
|
||||
let!(:user) { FactoryGirl.create(:user) }
|
||||
let!(:user) { FactoryBot.create(:user) }
|
||||
|
||||
before do
|
||||
FactoryGirl.create(:contact, person: alice.person, user: user)
|
||||
FactoryGirl.create(:contact, person: bob.person, user: user)
|
||||
FactoryBot.create(:contact, person: alice.person, user: user)
|
||||
FactoryBot.create(:contact, person: bob.person, user: user)
|
||||
expect(user.reload.contacts.size).to eq(2)
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ describe "Dispatching", type: :request do
|
||||
context "a comment retraction on a public post" do
|
||||
it "triggers a public dispatch" do
|
||||
# Alice has a public post and comments on it
|
||||
post = FactoryGirl.create(:status_message, public: true, author: alice.person)
|
||||
post = FactoryBot.create(:status_message, public: true, author: alice.person)
|
||||
|
||||
comment = alice.comment!(post, "awesomesauseum")
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ describe Diaspora::Exporter do
|
||||
create_basic_users
|
||||
|
||||
1000.times {
|
||||
FactoryGirl.create(:signed_comment, post: bob.person.posts.first)
|
||||
FactoryGirl.create(:status_message, author: bob.person)
|
||||
FactoryGirl.create(:comment, author: bob.person)
|
||||
FactoryGirl.create(:contact, user: bob)
|
||||
FactoryGirl.create(:participation, author: bob.person)
|
||||
FactoryBot.create(:signed_comment, post: bob.person.posts.first)
|
||||
FactoryBot.create(:status_message, author: bob.person)
|
||||
FactoryBot.create(:comment, author: bob.person)
|
||||
FactoryBot.create(:contact, user: bob)
|
||||
FactoryBot.create(:participation, author: bob.person)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# the COPYRIGHT file.
|
||||
|
||||
describe Diaspora::Exporter do
|
||||
let(:user) { FactoryGirl.create(:user_with_aspect) }
|
||||
let(:user) { FactoryBot.create(:user_with_aspect) }
|
||||
|
||||
context "output json" do
|
||||
let(:json) { Diaspora::Exporter.new(user).execute }
|
||||
@@ -74,7 +74,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a public status message" do
|
||||
status_message = FactoryGirl.create(:status_message, author: user.person, public: true)
|
||||
status_message = FactoryBot.create(:status_message, author: user.person, public: true)
|
||||
serialized = {
|
||||
"subscribed_pods_uris": [AppConfig.pod_uri.to_s],
|
||||
"entity_type": "status_message",
|
||||
@@ -108,7 +108,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a status message with a poll" do
|
||||
status_message = FactoryGirl.create(:status_message_with_poll, author: user.person)
|
||||
status_message = FactoryBot.create(:status_message_with_poll, author: user.person)
|
||||
serialized = {
|
||||
"entity_type": "status_message",
|
||||
"entity_data": {
|
||||
@@ -140,7 +140,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a status message with a photo" do
|
||||
status_message = FactoryGirl.create(:status_message_with_photo, author: user.person)
|
||||
status_message = FactoryBot.create(:status_message_with_photo, author: user.person)
|
||||
|
||||
serialized = {
|
||||
"entity_type": "status_message",
|
||||
@@ -173,7 +173,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a status message with a location" do
|
||||
status_message = FactoryGirl.create(:status_message_with_location, author: user.person)
|
||||
status_message = FactoryBot.create(:status_message_with_location, author: user.person)
|
||||
|
||||
serialized = {
|
||||
"entity_type": "status_message",
|
||||
@@ -198,7 +198,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a reshare" do
|
||||
reshare = FactoryGirl.create(:reshare, author: user.person)
|
||||
reshare = FactoryBot.create(:reshare, author: user.person)
|
||||
serialized_reshare = {
|
||||
"subscribed_pods_uris": [reshare.root.author.pod.url_to(""), AppConfig.pod_uri.to_s],
|
||||
"entity_type": "reshare",
|
||||
@@ -227,7 +227,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a comment" do
|
||||
comment = FactoryGirl.create(:comment, author: user.person)
|
||||
comment = FactoryBot.create(:comment, author: user.person)
|
||||
serialized_comment = {
|
||||
"entity_type": "comment",
|
||||
"entity_data": {
|
||||
@@ -246,7 +246,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a like" do
|
||||
like = FactoryGirl.create(:like, author: user.person)
|
||||
like = FactoryBot.create(:like, author: user.person)
|
||||
serialized_like = {
|
||||
"entity_type": "like",
|
||||
"entity_data": {
|
||||
@@ -265,7 +265,7 @@ describe Diaspora::Exporter do
|
||||
end
|
||||
|
||||
it "contains a poll participation" do
|
||||
poll_participation = FactoryGirl.create(:poll_participation, author: user.person)
|
||||
poll_participation = FactoryBot.create(:poll_participation, author: user.person)
|
||||
serialized_participation = {
|
||||
"entity_type": "poll_participation",
|
||||
"entity_data": {
|
||||
|
||||
@@ -42,7 +42,7 @@ describe "attack vectors", type: :request do
|
||||
end
|
||||
|
||||
it "public post should not be spoofed from another author" do
|
||||
post = FactoryGirl.build(:status_message, public: true, author: eve.person)
|
||||
post = FactoryBot.build(:status_message, public: true, author: eve.person)
|
||||
|
||||
post_message(generate_payload(Diaspora::Federation::Entities.post(post), alice))
|
||||
|
||||
@@ -77,7 +77,7 @@ describe "attack vectors", type: :request do
|
||||
original_message = eve.post(:status_message, text: "store this!", to: eves_aspect.id)
|
||||
|
||||
# someone else tries to make a message with the same guid
|
||||
malicious_message = FactoryGirl.build(
|
||||
malicious_message = FactoryBot.build(
|
||||
:status_message,
|
||||
id: original_message.id,
|
||||
guid: original_message.guid,
|
||||
@@ -95,7 +95,7 @@ describe "attack vectors", type: :request do
|
||||
original_message = eve.post(:status_message, text: "store this!", to: eves_aspect.id)
|
||||
|
||||
# eve tries to send me another message with the same ID
|
||||
malicious_message = FactoryGirl.build(:status_message, id: original_message.id, text: "BAD!!!", author: eve.person)
|
||||
malicious_message = FactoryBot.build(:status_message, id: original_message.id, text: "BAD!!!", author: eve.person)
|
||||
|
||||
post_message(generate_payload(Diaspora::Federation::Entities.post(malicious_message), eve, bob), bob)
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ def allow_public_key_fetch(user)
|
||||
end
|
||||
|
||||
def create_undiscovered_user(pod)
|
||||
FactoryGirl.build(:user).tap do |user|
|
||||
FactoryBot.build(:user).tap do |user|
|
||||
allow(user).to receive(:person).and_return(
|
||||
FactoryGirl.build(:person,
|
||||
profile: FactoryGirl.build(:profile),
|
||||
FactoryBot.build(:person,
|
||||
profile: FactoryBot.build(:profile),
|
||||
serialized_public_key: user.encryption_key.public_key.export,
|
||||
pod: Pod.find_or_create_by(url: "http://#{pod}"),
|
||||
diaspora_handle: "#{user.username}@#{pod}")
|
||||
|
||||
@@ -84,7 +84,7 @@ describe "Receive federation messages feature" do
|
||||
end
|
||||
|
||||
context "when our pod was left" do
|
||||
let(:sender) { FactoryGirl.create(:user) }
|
||||
let(:sender) { FactoryBot.create(:user) }
|
||||
|
||||
it "locks the old user account access" do
|
||||
run_migration
|
||||
@@ -108,7 +108,7 @@ describe "Receive federation messages feature" do
|
||||
|
||||
context "reshare" do
|
||||
it "reshare of public post passes" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: true)
|
||||
reshare = Fabricate(
|
||||
:reshare_entity, root_author: alice.diaspora_handle, root_guid: post.guid, author: sender_id)
|
||||
|
||||
@@ -128,7 +128,7 @@ describe "Receive federation messages feature" do
|
||||
end
|
||||
|
||||
it "reshare of private post fails" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: false)
|
||||
post = FactoryBot.create(:status_message, author: alice.person, public: false)
|
||||
reshare = Fabricate(
|
||||
:reshare_entity, root_author: alice.diaspora_handle, root_guid: post.guid, author: sender_id)
|
||||
expect {
|
||||
@@ -211,7 +211,7 @@ describe "Receive federation messages feature" do
|
||||
context "with message" do
|
||||
context "local" do
|
||||
let(:parent) {
|
||||
FactoryGirl.build(:conversation, author: alice.person).tap do |target|
|
||||
FactoryBot.build(:conversation, author: alice.person).tap do |target|
|
||||
target.participants << remote_user_on_pod_b.person
|
||||
target.participants << remote_user_on_pod_c.person
|
||||
target.save
|
||||
@@ -238,7 +238,7 @@ describe "Receive federation messages feature" do
|
||||
|
||||
context "remote" do
|
||||
let(:parent) {
|
||||
FactoryGirl.build(:conversation, author: remote_user_on_pod_b.person).tap do |target|
|
||||
FactoryBot.build(:conversation, author: remote_user_on_pod_b.person).tap do |target|
|
||||
target.participants << alice.person
|
||||
target.participants << remote_user_on_pod_c.person
|
||||
target.save
|
||||
|
||||
@@ -32,8 +32,8 @@ shared_examples_for "messages which are indifferent about sharing fact" do
|
||||
end
|
||||
|
||||
describe "with messages which require a status to operate on" do
|
||||
let(:local_parent) { FactoryGirl.create(:status_message, author: alice.person, public: public) }
|
||||
let(:remote_parent) { FactoryGirl.create(:status_message, author: remote_user_on_pod_b.person, public: public) }
|
||||
let(:local_parent) { FactoryBot.create(:status_message, author: alice.person, public: public) }
|
||||
let(:remote_parent) { FactoryBot.create(:status_message, author: remote_user_on_pod_b.person, public: public) }
|
||||
|
||||
describe "notifications are sent where required" do
|
||||
it "for comment on local post" do
|
||||
@@ -103,15 +103,15 @@ shared_examples_for "messages which are indifferent about sharing fact" do
|
||||
|
||||
context "with poll_participation" do
|
||||
let(:local_parent) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:poll,
|
||||
status_message: FactoryGirl.create(:status_message, author: alice.person, public: public)
|
||||
status_message: FactoryBot.create(:status_message, author: alice.person, public: public)
|
||||
)
|
||||
}
|
||||
let(:remote_parent) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:poll,
|
||||
status_message: FactoryGirl.create(:status_message, author: remote_user_on_pod_b.person, public: public)
|
||||
status_message: FactoryBot.create(:status_message, author: remote_user_on_pod_b.person, public: public)
|
||||
)
|
||||
}
|
||||
let(:entity_name) { :poll_participation_entity }
|
||||
@@ -127,7 +127,7 @@ shared_examples_for "messages which can't be send without sharing" do
|
||||
describe "retractions for non-relayable objects" do
|
||||
%w[status_message photo].each do |target|
|
||||
context "with #{target}" do
|
||||
let(:target_object) { FactoryGirl.create(target.to_sym, author: remote_user_on_pod_b.person) }
|
||||
let(:target_object) { FactoryBot.create(target.to_sym, author: remote_user_on_pod_b.person) }
|
||||
|
||||
it_behaves_like "it retracts non-relayable object"
|
||||
end
|
||||
@@ -136,8 +136,8 @@ shared_examples_for "messages which can't be send without sharing" do
|
||||
|
||||
describe "with messages which require a status to operate on" do
|
||||
let(:public) { recipient.nil? }
|
||||
let(:local_parent) { FactoryGirl.create(:status_message, author: alice.person, public: public) }
|
||||
let(:remote_parent) { FactoryGirl.create(:status_message, author: remote_user_on_pod_b.person, public: public) }
|
||||
let(:local_parent) { FactoryBot.create(:status_message, author: alice.person, public: public) }
|
||||
let(:remote_parent) { FactoryBot.create(:status_message, author: remote_user_on_pod_b.person, public: public) }
|
||||
|
||||
# this one shouldn't depend on the sharing fact. this must be fixed
|
||||
describe "notifications are sent where required" do
|
||||
@@ -168,14 +168,14 @@ shared_examples_for "messages which can't be send without sharing" do
|
||||
it_behaves_like "it retracts relayable object" do
|
||||
# case for to-upstream federation
|
||||
let(:target_object) {
|
||||
FactoryGirl.create(:comment, author: remote_user_on_pod_b.person, post: local_parent)
|
||||
FactoryBot.create(:comment, author: remote_user_on_pod_b.person, post: local_parent)
|
||||
}
|
||||
end
|
||||
|
||||
it_behaves_like "it retracts relayable object" do
|
||||
# case for to-downsteam federation
|
||||
let(:target_object) {
|
||||
FactoryGirl.create(:comment, author: remote_user_on_pod_c.person, post: remote_parent)
|
||||
FactoryBot.create(:comment, author: remote_user_on_pod_c.person, post: remote_parent)
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -184,14 +184,14 @@ shared_examples_for "messages which can't be send without sharing" do
|
||||
it_behaves_like "it retracts relayable object" do
|
||||
# case for to-upstream federation
|
||||
let(:target_object) {
|
||||
FactoryGirl.create(:like, author: remote_user_on_pod_b.person, target: local_parent)
|
||||
FactoryBot.create(:like, author: remote_user_on_pod_b.person, target: local_parent)
|
||||
}
|
||||
end
|
||||
|
||||
it_behaves_like "it retracts relayable object" do
|
||||
# case for to-downsteam federation
|
||||
let(:target_object) {
|
||||
FactoryGirl.create(:like, author: remote_user_on_pod_c.person, target: remote_parent)
|
||||
FactoryBot.create(:like, author: remote_user_on_pod_c.person, target: remote_parent)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -138,9 +138,9 @@ describe "mentioning", type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
let(:user1) { FactoryGirl.create(:user_with_aspect) }
|
||||
let(:user2) { FactoryGirl.create(:user_with_aspect, friends: [user1, user3]) }
|
||||
let(:user3) { FactoryGirl.create(:user_with_aspect) }
|
||||
let(:user1) { FactoryBot.create(:user_with_aspect) }
|
||||
let(:user2) { FactoryBot.create(:user_with_aspect, friends: [user1, user3]) }
|
||||
let(:user3) { FactoryBot.create(:user_with_aspect) }
|
||||
|
||||
# see: https://github.com/diaspora/diaspora/issues/4160
|
||||
it "only mentions people that are in the target aspect" do
|
||||
@@ -226,18 +226,18 @@ describe "mentioning", type: :request do
|
||||
end
|
||||
|
||||
context "in comments" do
|
||||
let(:author) { FactoryGirl.create(:user_with_aspect) }
|
||||
let(:author) { FactoryBot.create(:user_with_aspect) }
|
||||
|
||||
shared_context "commenter is author" do
|
||||
let(:commenter) { author }
|
||||
end
|
||||
|
||||
shared_context "commenter is author's friend" do
|
||||
let(:commenter) { FactoryGirl.create(:user_with_aspect, friends: [author]) }
|
||||
let(:commenter) { FactoryBot.create(:user_with_aspect, friends: [author]) }
|
||||
end
|
||||
|
||||
shared_context "commenter is not author's friend" do
|
||||
let(:commenter) { FactoryGirl.create(:user) }
|
||||
let(:commenter) { FactoryBot.create(:user) }
|
||||
end
|
||||
|
||||
shared_context "mentioned user is author" do
|
||||
@@ -245,15 +245,15 @@ describe "mentioning", type: :request do
|
||||
end
|
||||
|
||||
shared_context "mentioned user is author's friend" do
|
||||
let(:mentioned_user) { FactoryGirl.create(:user_with_aspect, friends: [author]) }
|
||||
let(:mentioned_user) { FactoryBot.create(:user_with_aspect, friends: [author]) }
|
||||
end
|
||||
|
||||
shared_context "mentioned user is not author's friend" do
|
||||
let(:mentioned_user) { FactoryGirl.create(:user) }
|
||||
let(:mentioned_user) { FactoryBot.create(:user) }
|
||||
end
|
||||
|
||||
context "with public post" do
|
||||
let(:status_msg) { FactoryGirl.create(:status_message, author: author.person, public: true) }
|
||||
let(:status_msg) { FactoryBot.create(:status_message, author: author.person, public: true) }
|
||||
|
||||
[
|
||||
["commenter is author's friend", "mentioned user is not author's friend"],
|
||||
@@ -281,7 +281,7 @@ describe "mentioning", type: :request do
|
||||
context "when comment is received via federation" do
|
||||
context "when mentioned user is remote" do
|
||||
it "relays the comment to the mentioned user" do
|
||||
mentioned_person = FactoryGirl.create(:person)
|
||||
mentioned_person = FactoryBot.create(:person)
|
||||
expect_any_instance_of(Diaspora::Federation::Dispatcher::Public)
|
||||
.to receive(:deliver_to_remote).with([mentioned_person])
|
||||
|
||||
@@ -301,7 +301,7 @@ describe "mentioning", type: :request do
|
||||
include_context commenters_context
|
||||
include_context mentioned_context
|
||||
|
||||
let(:parent) { FactoryGirl.create(:status_message_in_aspect, author: author.person) }
|
||||
let(:parent) { FactoryBot.create(:status_message_in_aspect, author: author.person) }
|
||||
let(:comment) {
|
||||
inlined_jobs do
|
||||
commenter.comment!(parent, text_mentioning(mentioned_user))
|
||||
@@ -318,7 +318,7 @@ describe "mentioning", type: :request do
|
||||
end
|
||||
|
||||
context "when comment is received via federation" do
|
||||
let(:parent) { FactoryGirl.create(:status_message_in_aspect, author: user2.person) }
|
||||
let(:parent) { FactoryBot.create(:status_message_in_aspect, author: user2.person) }
|
||||
|
||||
before do
|
||||
user3.like!(parent)
|
||||
@@ -355,7 +355,7 @@ describe "mentioning", type: :request do
|
||||
end
|
||||
|
||||
context "commenter can't mention a non-participant" do
|
||||
let(:status_msg) { FactoryGirl.create(:status_message_in_aspect, author: author.person) }
|
||||
let(:status_msg) { FactoryBot.create(:status_message_in_aspect, author: author.person) }
|
||||
|
||||
[
|
||||
["commenter is author's friend", "mentioned user is not author's friend"],
|
||||
@@ -381,8 +381,8 @@ describe "mentioning", type: :request do
|
||||
end
|
||||
|
||||
it "only creates one notification for the mentioned person, when mentioned person commented twice before" do
|
||||
parent = FactoryGirl.create(:status_message_in_aspect, author: author.person)
|
||||
mentioned_user = FactoryGirl.create(:user_with_aspect, friends: [author])
|
||||
parent = FactoryBot.create(:status_message_in_aspect, author: author.person)
|
||||
mentioned_user = FactoryBot.create(:user_with_aspect, friends: [author])
|
||||
mentioned_user.comment!(parent, "test comment 1")
|
||||
mentioned_user.comment!(parent, "test comment 2")
|
||||
comment = inlined_jobs do
|
||||
|
||||
@@ -43,10 +43,10 @@ describe MigrationService do
|
||||
Fabricate(:like_entity,
|
||||
author: archive_author,
|
||||
author_signature: "ignored XXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
parent_guid: FactoryGirl.create(:status_message).guid)
|
||||
parent_guid: FactoryBot.create(:status_message).guid)
|
||||
}
|
||||
let(:poll_participation_entity) {
|
||||
poll = FactoryGirl.create(:status_message_with_poll).poll
|
||||
poll = FactoryBot.create(:status_message_with_poll).poll
|
||||
Fabricate(:poll_participation_entity,
|
||||
author: archive_author,
|
||||
author_signature: "ignored XXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
@@ -70,14 +70,14 @@ describe MigrationService do
|
||||
Fabricate(:comment_entity, data)
|
||||
}
|
||||
|
||||
let(:post_subscriber) { FactoryGirl.create(:person) }
|
||||
let(:known_contact_person) { FactoryGirl.create(:person) }
|
||||
let!(:collided_status_message) { FactoryGirl.create(:status_message, guid: colliding_status_message_entity.guid) }
|
||||
let!(:collided_like) { FactoryGirl.create(:like, guid: like_entity.guid) }
|
||||
let!(:reshare_root_author) { FactoryGirl.create(:person, diaspora_handle: reshare_entity.root_author) }
|
||||
let(:post_subscriber) { FactoryBot.create(:person) }
|
||||
let(:known_contact_person) { FactoryBot.create(:person) }
|
||||
let!(:collided_status_message) { FactoryBot.create(:status_message, guid: colliding_status_message_entity.guid) }
|
||||
let!(:collided_like) { FactoryBot.create(:like, guid: like_entity.guid) }
|
||||
let!(:reshare_root_author) { FactoryBot.create(:person, diaspora_handle: reshare_entity.root_author) }
|
||||
|
||||
# This is for testing migrated contacts handling
|
||||
let(:account_migration) { FactoryGirl.create(:account_migration).tap(&:perform!) }
|
||||
let(:account_migration) { FactoryBot.create(:account_migration).tap(&:perform!) }
|
||||
let(:migrated_contact_diaspora_id) { account_migration.old_person.diaspora_handle }
|
||||
let(:migrated_contact_new_diaspora_id) { account_migration.new_person.diaspora_handle }
|
||||
|
||||
@@ -175,7 +175,7 @@ describe MigrationService do
|
||||
expect(DiasporaFederation::Federation::Fetcher)
|
||||
.to receive(:fetch_public)
|
||||
.with(root_author.diaspora_handle, "Post", root_guid) {
|
||||
FactoryGirl.create(:status_message, guid: root_guid, author: root_author, public: true)
|
||||
FactoryBot.create(:status_message, guid: root_guid, author: root_author, public: true)
|
||||
}
|
||||
end
|
||||
|
||||
@@ -195,13 +195,13 @@ describe MigrationService do
|
||||
|
||||
# This is expected to be called during relayable validation
|
||||
expect_relayable_parent_fetch(archive_author, comment_entity.parent_guid) {
|
||||
FactoryGirl.create(:status_message, guid: comment_entity.parent_guid)
|
||||
FactoryBot.create(:status_message, guid: comment_entity.parent_guid)
|
||||
}
|
||||
|
||||
expect_relayable_parent_fetch(archive_author, unknown_poll_guid, "Poll") {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:poll_answer,
|
||||
poll: FactoryGirl.create(:poll, guid: unknown_poll_guid),
|
||||
poll: FactoryBot.create(:poll, guid: unknown_poll_guid),
|
||||
guid: unknown_poll_answer_guid
|
||||
)
|
||||
}
|
||||
@@ -219,7 +219,7 @@ describe MigrationService do
|
||||
shared_examples "imports archive" do
|
||||
it "imports archive" do
|
||||
expect_relayable_parent_fetch(archive_author, unknown_subscription_guid) {
|
||||
FactoryGirl.create(:status_message, guid: unknown_subscription_guid)
|
||||
FactoryBot.create(:status_message, guid: unknown_subscription_guid)
|
||||
}
|
||||
|
||||
expect_reshare_root_fetch(reshare_root_author, reshare_entity.root_guid)
|
||||
@@ -316,22 +316,22 @@ describe MigrationService do
|
||||
|
||||
context "old user is a known remote user" do
|
||||
let(:old_person) {
|
||||
FactoryGirl.create(:person,
|
||||
profile: FactoryGirl.build(:profile),
|
||||
FactoryBot.create(:person,
|
||||
profile: FactoryBot.build(:profile),
|
||||
serialized_public_key: archive_private_key.public_key.export,
|
||||
diaspora_handle: archive_author)
|
||||
}
|
||||
|
||||
# Some existing data for old_person to test data merge/migration
|
||||
let!(:existing_contact) { FactoryGirl.create(:contact, person: old_person, sharing: true, receiving: true) }
|
||||
let!(:existing_contact) { FactoryBot.create(:contact, person: old_person, sharing: true, receiving: true) }
|
||||
|
||||
let!(:existing_subscription) {
|
||||
FactoryGirl.create(:participation,
|
||||
FactoryBot.create(:participation,
|
||||
author: old_person,
|
||||
target: FactoryGirl.create(:status_message, guid: existing_subscription_guid))
|
||||
target: FactoryBot.create(:status_message, guid: existing_subscription_guid))
|
||||
}
|
||||
let!(:existing_status_message) {
|
||||
FactoryGirl.create(:status_message,
|
||||
FactoryBot.create(:status_message,
|
||||
author: old_person,
|
||||
guid: known_status_message_entity.guid).tap {|status_message|
|
||||
status_message.participants << post_subscriber
|
||||
@@ -347,7 +347,7 @@ describe MigrationService do
|
||||
context "when account migration already exists" do
|
||||
before do
|
||||
setup_validation_time_expectations
|
||||
FactoryGirl.create(:account_migration, old_person: old_person)
|
||||
FactoryBot.create(:account_migration, old_person: old_person)
|
||||
end
|
||||
|
||||
it "raises exception" do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
describe PostsController, type: :request do
|
||||
context "with a poll" do
|
||||
let(:sm) { FactoryGirl.build(:status_message_with_poll, public: true) }
|
||||
let(:sm) { FactoryBot.build(:status_message_with_poll, public: true) }
|
||||
|
||||
it "displays the poll" do
|
||||
get "/posts/#{sm.id}", params: {format: :mobile}
|
||||
@@ -23,7 +23,7 @@ describe PostsController, type: :request do
|
||||
end
|
||||
|
||||
context "with a location" do
|
||||
let(:sm) { FactoryGirl.build(:status_message_with_location, public: true) }
|
||||
let(:sm) { FactoryBot.build(:status_message_with_location, public: true) }
|
||||
|
||||
it "displays the location" do
|
||||
get "/posts/#{sm.id}", params: {format: :mobile}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
describe TagsController, type: :request do
|
||||
describe 'will_paginate people on the tag page' do
|
||||
let(:people) { (1..2).map { FactoryGirl.create(:person) } }
|
||||
let(:people) { (1..2).map { FactoryBot.create(:person) } }
|
||||
let(:tag) { "diaspora" }
|
||||
|
||||
before do
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Api::OpenidConnect::ProtectedResourceEndpoint, type: :request do
|
||||
let(:auth_with_read) { FactoryGirl.create(:auth_with_read_scopes) }
|
||||
let(:auth_with_read) { FactoryBot.create(:auth_with_read_scopes) }
|
||||
let!(:access_token_with_read) { auth_with_read.create_access_token.to_s }
|
||||
let!(:expired_access_token) do
|
||||
access_token = auth_with_read.o_auth_access_tokens.create!
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Api::OpenidConnect::TokenEndpoint, type: :request do
|
||||
let!(:client) { FactoryGirl.create(:o_auth_application_with_ppid) }
|
||||
let!(:client) { FactoryBot.create(:o_auth_application_with_ppid) }
|
||||
let!(:auth) {
|
||||
Api::OpenidConnect::Authorization.find_or_create_by(
|
||||
o_auth_application: client, user: bob, redirect_uri: "http://localhost:3000/", scopes: ["openid"])
|
||||
}
|
||||
let!(:code) { auth.create_code }
|
||||
let!(:client_with_specific_id) { FactoryGirl.create(:o_auth_application_with_ppid) }
|
||||
let!(:client_with_specific_id) { FactoryBot.create(:o_auth_application_with_ppid) }
|
||||
let!(:auth_with_specific_id) do
|
||||
client_with_specific_id.client_id = "14d692cd53d9c1a9f46fd69e0e57443e"
|
||||
client_with_specific_id.jwks = File.read(jwks_file_path)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe ArchiveImporter::ContactImporter do
|
||||
let(:target) { FactoryGirl.create(:user) }
|
||||
let(:target) { FactoryBot.create(:user) }
|
||||
let(:contact_importer) { described_class.new(import_object, target) }
|
||||
|
||||
describe "#import" do
|
||||
@@ -33,8 +33,8 @@ describe ArchiveImporter::ContactImporter do
|
||||
end
|
||||
|
||||
context "with correct data" do
|
||||
let(:aspect) { FactoryGirl.create(:aspect, user: target) }
|
||||
let(:person) { FactoryGirl.create(:person) }
|
||||
let(:aspect) { FactoryBot.create(:aspect, user: target) }
|
||||
let(:person) { FactoryBot.create(:person) }
|
||||
let(:import_object) {
|
||||
{
|
||||
"person_guid" => person.guid,
|
||||
|
||||
@@ -19,7 +19,7 @@ describe ArchiveImporter::EntityImporter do
|
||||
JSON
|
||||
|
||||
context "with known author" do
|
||||
let!(:author) { FactoryGirl.create(:person, diaspora_handle: "author@example.com") }
|
||||
let!(:author) { FactoryBot.create(:person, diaspora_handle: "author@example.com") }
|
||||
|
||||
it "runs entity receive routine" do
|
||||
expect(Diaspora::Federation::Receive).to receive(:perform)
|
||||
@@ -45,8 +45,8 @@ describe ArchiveImporter::EntityImporter do
|
||||
end
|
||||
|
||||
context "with comment" do
|
||||
let(:status_message) { FactoryGirl.create(:status_message) }
|
||||
let(:author) { FactoryGirl.create(:user) }
|
||||
let(:status_message) { FactoryBot.create(:status_message) }
|
||||
let(:author) { FactoryBot.create(:user) }
|
||||
let(:comment_entity) {
|
||||
data = Fabricate.attributes_for(:comment_entity,
|
||||
author: author.diaspora_handle,
|
||||
@@ -68,12 +68,12 @@ describe ArchiveImporter::EntityImporter do
|
||||
end
|
||||
|
||||
it "does not relay a remote comment during import" do
|
||||
comment_author = FactoryGirl.build(:user)
|
||||
comment_author = FactoryBot.build(:user)
|
||||
comment_author.person.owner = nil
|
||||
comment_author.person.pod = Pod.find_or_create_by(url: "http://example.net")
|
||||
comment_author.person.save!
|
||||
|
||||
status_message = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
status_message = FactoryBot.create(:status_message, author: alice.person, public: true)
|
||||
comment_data = Fabricate.attributes_for(:comment_entity,
|
||||
author: comment_author.diaspora_handle,
|
||||
parent_guid: status_message.guid).tap do |data|
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
shared_examples "own entity importer" do
|
||||
describe "#import" do
|
||||
let(:new_user) { FactoryGirl.create(:user) }
|
||||
let(:new_user) { FactoryBot.create(:user) }
|
||||
let(:instance) { described_class.new(entity_json.as_json, new_user) }
|
||||
|
||||
context "with known entity" do
|
||||
|
||||
@@ -5,7 +5,7 @@ require "lib/archive_importer/own_entity_importer_shared"
|
||||
describe ArchiveImporter::OwnEntityImporter do
|
||||
it_behaves_like "own entity importer" do
|
||||
let(:entity_class) { StatusMessage }
|
||||
let!(:status_message) { FactoryGirl.create(:status_message) }
|
||||
let!(:status_message) { FactoryBot.create(:status_message) }
|
||||
let(:entity) { Diaspora::Federation::Entities.build(status_message) }
|
||||
|
||||
let(:known_entity_with_correct_author) {
|
||||
@@ -14,7 +14,7 @@ describe ArchiveImporter::OwnEntityImporter do
|
||||
|
||||
let(:known_entity_with_incorrect_author) {
|
||||
result = known_entity_with_correct_author
|
||||
result[:entity_data][:author] = FactoryGirl.create(:person).diaspora_handle
|
||||
result[:entity_data][:author] = FactoryBot.create(:person).diaspora_handle
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ require "lib/archive_importer/own_entity_importer_shared"
|
||||
describe ArchiveImporter::OwnRelayableImporter do
|
||||
it_behaves_like "own entity importer" do
|
||||
let(:entity_class) { Comment }
|
||||
let!(:comment) { FactoryGirl.create(:comment, author: FactoryGirl.create(:user).person) }
|
||||
let!(:comment) { FactoryBot.create(:comment, author: FactoryBot.create(:user).person) }
|
||||
|
||||
let(:known_entity_with_correct_author) {
|
||||
Diaspora::Federation::Entities.build(comment).to_json
|
||||
@@ -14,7 +14,7 @@ describe ArchiveImporter::OwnRelayableImporter do
|
||||
let(:known_entity_with_incorrect_author) {
|
||||
Fabricate(
|
||||
:comment_entity,
|
||||
author: FactoryGirl.create(:user).diaspora_handle,
|
||||
author: FactoryBot.create(:user).diaspora_handle,
|
||||
guid: comment.guid,
|
||||
parent_guid: comment.parent.guid
|
||||
).to_json
|
||||
@@ -23,8 +23,8 @@ describe ArchiveImporter::OwnRelayableImporter do
|
||||
let(:unknown_entity) {
|
||||
Fabricate(
|
||||
:comment_entity,
|
||||
author: FactoryGirl.create(:user).diaspora_handle,
|
||||
parent_guid: FactoryGirl.create(:status_message).guid
|
||||
author: FactoryBot.create(:user).diaspora_handle,
|
||||
parent_guid: FactoryBot.create(:status_message).guid
|
||||
).to_json
|
||||
}
|
||||
end
|
||||
|
||||
@@ -5,14 +5,14 @@ require "lib/archive_importer/own_entity_importer_shared"
|
||||
describe ArchiveImporter::PostImporter do
|
||||
describe "#import" do
|
||||
let(:old_person) { post.author }
|
||||
let(:new_user) { FactoryGirl.create(:user) }
|
||||
let(:new_user) { FactoryBot.create(:user) }
|
||||
let(:entity) { Diaspora::Federation::Entities.build(post) }
|
||||
let(:entity_json) { entity.to_json.as_json }
|
||||
let(:instance) { described_class.new(entity_json, new_user) }
|
||||
|
||||
it_behaves_like "own entity importer" do
|
||||
let(:entity_class) { StatusMessage }
|
||||
let!(:post) { FactoryGirl.create(:status_message) }
|
||||
let!(:post) { FactoryBot.create(:status_message) }
|
||||
|
||||
let(:known_entity_with_correct_author) {
|
||||
entity.to_json
|
||||
@@ -20,7 +20,7 @@ describe ArchiveImporter::PostImporter do
|
||||
|
||||
let(:known_entity_with_incorrect_author) {
|
||||
result = known_entity_with_correct_author
|
||||
result[:entity_data][:author] = FactoryGirl.create(:person).diaspora_handle
|
||||
result[:entity_data][:author] = FactoryBot.create(:person).diaspora_handle
|
||||
result
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ describe ArchiveImporter::PostImporter do
|
||||
end
|
||||
|
||||
context "with subscription" do
|
||||
let(:post) { FactoryGirl.build(:status_message, public: true) }
|
||||
let(:subscribed_person) { FactoryGirl.create(:person) }
|
||||
let(:post) { FactoryBot.build(:status_message, public: true) }
|
||||
let(:subscribed_person) { FactoryBot.create(:person) }
|
||||
let(:subscribed_person_id) { subscribed_person.diaspora_handle }
|
||||
|
||||
before do
|
||||
@@ -66,7 +66,7 @@ describe ArchiveImporter::PostImporter do
|
||||
end
|
||||
|
||||
context "when subscribed user has migrated" do
|
||||
let(:account_migration) { FactoryGirl.create(:account_migration) }
|
||||
let(:account_migration) { FactoryBot.create(:account_migration) }
|
||||
let(:subscribed_person) { account_migration.old_person }
|
||||
|
||||
# TODO: rewrite this test when new subscription implementation is there
|
||||
|
||||
@@ -4,7 +4,7 @@ require "integration/federation/federation_helper"
|
||||
|
||||
describe ArchiveImporter do
|
||||
describe "#import" do
|
||||
let(:target) { FactoryGirl.create(:user) }
|
||||
let(:target) { FactoryBot.create(:user) }
|
||||
let(:archive_importer) {
|
||||
archive_importer = ArchiveImporter.new(archive_hash)
|
||||
archive_importer.user = target
|
||||
@@ -32,7 +32,7 @@ describe ArchiveImporter do
|
||||
end
|
||||
|
||||
context "with subscription" do
|
||||
let(:status_message) { FactoryGirl.create(:status_message) }
|
||||
let(:status_message) { FactoryBot.create(:status_message) }
|
||||
let(:archive_hash) {
|
||||
{
|
||||
"user" => {
|
||||
|
||||
@@ -6,7 +6,7 @@ describe ArchiveValidator::AuthorPrivateKeyValidator do
|
||||
include_context "validators shared context"
|
||||
|
||||
context "when private key doesn't match the key in the archive" do
|
||||
let(:author) { FactoryGirl.create(:person) }
|
||||
let(:author) { FactoryBot.create(:person) }
|
||||
|
||||
it "contains error" do
|
||||
expect(validator.messages)
|
||||
@@ -19,7 +19,7 @@ describe ArchiveValidator::AuthorPrivateKeyValidator do
|
||||
let(:author_pkey) { OpenSSL::PKey::RSA.generate(512) }
|
||||
let(:archive_private_key) { author_pkey.export }
|
||||
|
||||
let(:author) { FactoryGirl.create(:person, serialized_public_key: author_pkey.public_key.export) }
|
||||
let(:author) { FactoryBot.create(:person, serialized_public_key: author_pkey.public_key.export) }
|
||||
|
||||
include_examples "validation result is valid"
|
||||
end
|
||||
@@ -38,7 +38,7 @@ describe ArchiveValidator::AuthorPrivateKeyValidator do
|
||||
RSA
|
||||
|
||||
let(:author) {
|
||||
FactoryGirl.create(:person, serialized_public_key: <<~RSA)
|
||||
FactoryBot.create(:person, serialized_public_key: <<~RSA)
|
||||
-----BEGIN RSA PUBLIC KEY-----
|
||||
MEgCQQDbMMJomgsvb5XguS+UrQnvPrq2/1CkMGKYXlgPgRUin/VSwU24C8FjHIKB
|
||||
lKi2kuka4XBlcZperynttJSxacThAgMBAAE=
|
||||
|
||||
@@ -17,7 +17,7 @@ describe ArchiveValidator::ContactValidator do
|
||||
end
|
||||
|
||||
context "with a correct contact" do
|
||||
let(:known_id) { FactoryGirl.create(:person).diaspora_handle }
|
||||
let(:known_id) { FactoryBot.create(:person).diaspora_handle }
|
||||
|
||||
before do
|
||||
include_in_input_archive(
|
||||
@@ -47,7 +47,7 @@ describe ArchiveValidator::ContactValidator do
|
||||
context "and discovery is successful" do
|
||||
before do
|
||||
expect_any_instance_of(DiasporaFederation::Discovery::Discovery).to receive(:fetch_and_save) {
|
||||
FactoryGirl.create(:person, diaspora_handle: unknown_id)
|
||||
FactoryBot.create(:person, diaspora_handle: unknown_id)
|
||||
}
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ describe ArchiveValidator::ContactValidator do
|
||||
end
|
||||
|
||||
context "when person is deleted" do
|
||||
let(:person) { FactoryGirl.create(:person) }
|
||||
let(:person) { FactoryBot.create(:person) }
|
||||
let(:diaspora_id) { person.diaspora_handle }
|
||||
|
||||
let(:contact) {
|
||||
@@ -95,7 +95,7 @@ describe ArchiveValidator::ContactValidator do
|
||||
end
|
||||
|
||||
context "when person is migrated" do
|
||||
let(:account_migration) { FactoryGirl.create(:account_migration).tap(&:perform!) }
|
||||
let(:account_migration) { FactoryBot.create(:account_migration).tap(&:perform!) }
|
||||
let(:person) { account_migration.old_person }
|
||||
let(:diaspora_id) { person.diaspora_handle }
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ describe ArchiveValidator::ContactsValidator do
|
||||
include_context "with known author"
|
||||
|
||||
let(:correct_item) {
|
||||
person = FactoryGirl.create(:person)
|
||||
person = FactoryBot.create(:person)
|
||||
{
|
||||
"contact_groups_membership" => [],
|
||||
"person_guid" => person.guid,
|
||||
@@ -30,7 +30,7 @@ describe ArchiveValidator::ContactsValidator do
|
||||
}
|
||||
|
||||
let(:incorrect_item) {
|
||||
person = FactoryGirl.create(:person)
|
||||
person = FactoryBot.create(:person)
|
||||
person.lock_access!
|
||||
{
|
||||
"contact_groups_membership" => [],
|
||||
|
||||
@@ -7,14 +7,14 @@ describe ArchiveValidator::OwnRelayableValidator do
|
||||
include_context "relayable validator context"
|
||||
|
||||
let(:relayable_entity) { :comment_entity }
|
||||
let(:author) { FactoryGirl.create(:user).person }
|
||||
let(:author) { FactoryBot.create(:user).person }
|
||||
|
||||
let(:relayable_author) {
|
||||
author_id
|
||||
}
|
||||
|
||||
def create_root
|
||||
FactoryGirl.create(:status_message, guid: parent_guid)
|
||||
FactoryBot.create(:status_message, guid: parent_guid)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -32,7 +32,7 @@ describe ArchiveValidator::OwnRelayableValidator do
|
||||
expect(DiasporaFederation::Federation::Fetcher)
|
||||
.to receive(:fetch_public)
|
||||
.with(author.diaspora_handle, "Post", parent_guid) {
|
||||
FactoryGirl.create(:status_message, guid: parent_guid)
|
||||
FactoryBot.create(:status_message, guid: parent_guid)
|
||||
}
|
||||
end
|
||||
|
||||
@@ -85,7 +85,7 @@ describe ArchiveValidator::OwnRelayableValidator do
|
||||
|
||||
context "with known root" do
|
||||
def create_root
|
||||
smwp = FactoryGirl.create(:status_message_with_poll)
|
||||
smwp = FactoryBot.create(:status_message_with_poll)
|
||||
smwp.poll.update(guid: parent_guid)
|
||||
end
|
||||
|
||||
@@ -100,7 +100,7 @@ describe ArchiveValidator::OwnRelayableValidator do
|
||||
expect(DiasporaFederation::Federation::Fetcher)
|
||||
.to receive(:fetch_public)
|
||||
.with(author.diaspora_handle, "Poll", parent_guid) {
|
||||
FactoryGirl.create(:poll, guid: parent_guid)
|
||||
FactoryBot.create(:poll, guid: parent_guid)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ describe ArchiveValidator::PostsValidator do
|
||||
include_context "with known author"
|
||||
|
||||
let(:correct_item) {
|
||||
status_message = FactoryGirl.create(:status_message)
|
||||
status_message = FactoryBot.create(:status_message)
|
||||
{
|
||||
"entity_data" => {
|
||||
"guid" => UUID.generate(:compact),
|
||||
|
||||
@@ -6,7 +6,7 @@ describe ArchiveValidator::RelayableValidator do
|
||||
include_context "validators shared context"
|
||||
include_context "relayable validator context"
|
||||
|
||||
let(:author) { FactoryGirl.create(:user).person }
|
||||
let(:author) { FactoryBot.create(:user).person }
|
||||
|
||||
context "with comment" do
|
||||
let(:relayable_entity) { :comment_entity }
|
||||
|
||||
@@ -6,7 +6,7 @@ describe ArchiveValidator::RelayablesValidator do
|
||||
include_context "validators shared context"
|
||||
include_context "with known author"
|
||||
|
||||
let(:parent_guid) { FactoryGirl.create(:status_message).guid }
|
||||
let(:parent_guid) { FactoryBot.create(:status_message).guid }
|
||||
let(:not_found_guid) {
|
||||
UUID.generate(:compact).tap {|guid|
|
||||
stub_request(:get, "http://example.net/fetch/post/#{guid}").to_return(status: 404)
|
||||
|
||||
@@ -45,7 +45,7 @@ shared_context "validators shared context" do
|
||||
end
|
||||
|
||||
shared_context "with known author" do
|
||||
let(:author) { FactoryGirl.create(:person) }
|
||||
let(:author) { FactoryBot.create(:person) }
|
||||
end
|
||||
|
||||
shared_examples "validation result is valid" do
|
||||
@@ -87,7 +87,7 @@ shared_examples "a relayable validator" do
|
||||
|
||||
context "when the comment is already known" do
|
||||
let!(:original_comment) {
|
||||
FactoryGirl.create(:comment, guid: guid, author: Person.by_account_identifier(relayable_author))
|
||||
FactoryBot.create(:comment, guid: guid, author: Person.by_account_identifier(relayable_author))
|
||||
}
|
||||
|
||||
include_examples "validation result is valid"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Diaspora::Exporter::OthersRelayables do
|
||||
let(:status_message) { FactoryGirl.create(:status_message) }
|
||||
let(:status_message) { FactoryBot.create(:status_message) }
|
||||
let(:person) { status_message.author }
|
||||
let(:instance) { Diaspora::Exporter::OthersRelayables.new(person.id) }
|
||||
|
||||
describe "#comments" do
|
||||
let(:comment) { FactoryGirl.create(:comment, post: status_message) }
|
||||
let(:comment) { FactoryBot.create(:comment, post: status_message) }
|
||||
|
||||
it "has a comment in the data set" do
|
||||
expect(instance.comments).to eq([comment])
|
||||
@@ -14,7 +14,7 @@ describe Diaspora::Exporter::OthersRelayables do
|
||||
end
|
||||
|
||||
describe "#likes" do
|
||||
let(:like) { FactoryGirl.create(:like, target: status_message) }
|
||||
let(:like) { FactoryBot.create(:like, target: status_message) }
|
||||
|
||||
it "has a like in the data set" do
|
||||
expect(instance.likes).to eq([like])
|
||||
@@ -22,9 +22,9 @@ describe Diaspora::Exporter::OthersRelayables do
|
||||
end
|
||||
|
||||
describe "#poll_participations" do
|
||||
let(:status_message) { FactoryGirl.create(:status_message_with_poll) }
|
||||
let(:status_message) { FactoryBot.create(:status_message_with_poll) }
|
||||
let(:poll_participation) {
|
||||
FactoryGirl.create(
|
||||
FactoryBot.create(
|
||||
:poll_participation,
|
||||
poll_answer: status_message.poll.poll_answers.first
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ describe Diaspora::Exporter do
|
||||
expect_any_instance_of(Export::UserSerializer).to receive(:as_json).and_return(user: "user_data")
|
||||
expect_any_instance_of(Export::OthersDataSerializer).to receive(:as_json).and_return(others_date: "others_data")
|
||||
|
||||
json = Diaspora::Exporter.new(FactoryGirl.create(:user)).execute
|
||||
json = Diaspora::Exporter.new(FactoryBot.create(:user)).execute
|
||||
expect(json).to include_json(
|
||||
version: "2.0",
|
||||
user: "user_data",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe ContactRetraction do
|
||||
let(:contact) { FactoryGirl.build(:contact, sharing: true, receiving: true) }
|
||||
let(:contact) { FactoryBot.build(:contact, sharing: true, receiving: true) }
|
||||
let(:retraction) { ContactRetraction.for(contact) }
|
||||
|
||||
describe "#subscribers" do
|
||||
@@ -22,7 +22,7 @@ describe ContactRetraction do
|
||||
|
||||
describe ".retraction_data_for" do
|
||||
it "creates a retraction for a contact" do
|
||||
contact = FactoryGirl.build(:contact, sharing: false, receiving: false)
|
||||
contact = FactoryBot.build(:contact, sharing: false, receiving: false)
|
||||
expect(Diaspora::Federation::Entities).to receive(:contact).with(contact).and_call_original
|
||||
data = ContactRetraction.retraction_data_for(contact)
|
||||
|
||||
@@ -48,7 +48,7 @@ describe ContactRetraction do
|
||||
|
||||
describe ".defer_dispatch" do
|
||||
it "queues a job to send the retraction later" do
|
||||
contact = FactoryGirl.build(:contact, user: local_luke, person: remote_raphael)
|
||||
contact = FactoryBot.build(:contact, user: local_luke, person: remote_raphael)
|
||||
retraction = ContactRetraction.for(contact)
|
||||
federation_retraction_data = Diaspora::Federation::Entities.contact(contact).to_h
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ describe Retraction do
|
||||
end
|
||||
|
||||
it "creates the retraction data for a relayable" do
|
||||
comment = FactoryGirl.create(:comment, author: alice.person, post: post)
|
||||
comment = FactoryBot.create(:comment, author: alice.person, post: post)
|
||||
|
||||
data = Retraction.retraction_data_for(comment)
|
||||
expect(data[:target_guid]).to eq(comment.guid)
|
||||
@@ -55,7 +55,7 @@ describe Retraction do
|
||||
end
|
||||
|
||||
it "creates a retraction for a relayable" do
|
||||
comment = FactoryGirl.create(:comment, author: alice.person, post: post)
|
||||
comment = FactoryBot.create(:comment, author: alice.person, post: post)
|
||||
|
||||
expect(Retraction).to receive(:retraction_data_for).with(comment)
|
||||
|
||||
@@ -117,7 +117,7 @@ describe Retraction do
|
||||
|
||||
context "relayable" do
|
||||
let(:post) { local_luke.post(:status_message, text: "hello", public: true) }
|
||||
let(:comment) { FactoryGirl.create(:comment, post: post, author: remote_raphael) }
|
||||
let(:comment) { FactoryBot.create(:comment, post: post, author: remote_raphael) }
|
||||
|
||||
it "sends retraction to target author if deleted by parent author" do
|
||||
retraction = Retraction.for(comment)
|
||||
@@ -161,7 +161,7 @@ describe Retraction do
|
||||
end
|
||||
|
||||
it "returns true for a public comment if parent post is not local" do
|
||||
remote_post = FactoryGirl.create(:status_message, author: remote_raphael, public: true)
|
||||
remote_post = FactoryBot.create(:status_message, author: remote_raphael, public: true)
|
||||
comment = alice.comment!(remote_post, "destroy!")
|
||||
expect(Retraction.for(comment).public?).to be_truthy
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Diaspora::Federation::Dispatcher::Private do
|
||||
let(:post) { FactoryGirl.create(:status_message, author: alice.person, text: "hello", public: false) }
|
||||
let(:comment) { FactoryGirl.create(:comment, author: alice.person, post: post) }
|
||||
let(:post) { FactoryBot.create(:status_message, author: alice.person, text: "hello", public: false) }
|
||||
let(:comment) { FactoryBot.create(:comment, author: alice.person, post: post) }
|
||||
|
||||
before do
|
||||
alice.share_with(remote_raphael, alice.aspects.first)
|
||||
@@ -16,7 +16,7 @@ describe Diaspora::Federation::Dispatcher::Private do
|
||||
aspect2 = alice.aspects.create(name: "cat people")
|
||||
alice.add_contact_to_aspect(alice.contact_for(bob.person), aspect2)
|
||||
|
||||
post = FactoryGirl.create(
|
||||
post = FactoryBot.create(
|
||||
:status_message,
|
||||
author: alice.person,
|
||||
text: "hello",
|
||||
@@ -58,7 +58,7 @@ describe Diaspora::Federation::Dispatcher::Private do
|
||||
end
|
||||
|
||||
it "does not queue a private send job when no remote recipients specified" do
|
||||
bobs_post = FactoryGirl.create(:status_message, author: alice.person, text: "hello", public: false)
|
||||
bobs_post = FactoryBot.create(:status_message, author: alice.person, text: "hello", public: false)
|
||||
bob.add_to_streams(bobs_post, [bob.aspects.first])
|
||||
|
||||
expect(Workers::SendPrivate).not_to receive(:perform_async)
|
||||
@@ -67,7 +67,7 @@ describe Diaspora::Federation::Dispatcher::Private do
|
||||
end
|
||||
|
||||
it "queues private send job for a specific subscriber" do
|
||||
remote_person = FactoryGirl.create(:person)
|
||||
remote_person = FactoryBot.create(:person)
|
||||
|
||||
expect(Workers::SendPrivate).to receive(:perform_async) do |user_id, _entity_string, targets|
|
||||
expect(user_id).to eq(alice.id)
|
||||
@@ -91,9 +91,9 @@ describe Diaspora::Federation::Dispatcher::Private do
|
||||
end
|
||||
|
||||
it "only queues a private send job for a active pods" do
|
||||
remote_person = FactoryGirl.create(:person)
|
||||
offline_pod = FactoryGirl.create(:pod, status: :net_failed, offline_since: DateTime.now.utc - 15.days)
|
||||
offline_person = FactoryGirl.create(:person, pod: offline_pod)
|
||||
remote_person = FactoryBot.create(:person)
|
||||
offline_pod = FactoryBot.create(:pod, status: :net_failed, offline_since: DateTime.now.utc - 15.days)
|
||||
offline_person = FactoryBot.create(:person, pod: offline_pod)
|
||||
|
||||
expect(Workers::SendPrivate).to receive(:perform_async) do |user_id, _entity_string, targets|
|
||||
expect(user_id).to eq(alice.id)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe Diaspora::Federation::Dispatcher::Public do
|
||||
let(:post) { FactoryGirl.create(:status_message, author: alice.person, text: "hello", public: true) }
|
||||
let(:comment) { FactoryGirl.create(:comment, author: alice.person, post: post) }
|
||||
let(:post) { FactoryBot.create(:status_message, author: alice.person, text: "hello", public: true) }
|
||||
let(:comment) { FactoryBot.create(:comment, author: alice.person, post: post) }
|
||||
|
||||
describe "#dispatch" do
|
||||
context "pubsubhubbub" do
|
||||
@@ -96,8 +96,8 @@ describe Diaspora::Federation::Dispatcher::Public do
|
||||
end
|
||||
|
||||
it "only queues a public send job for a active pods" do
|
||||
offline_pod = FactoryGirl.create(:pod, status: :net_failed, offline_since: DateTime.now.utc - 15.days)
|
||||
offline_person = FactoryGirl.create(:person, pod: offline_pod)
|
||||
offline_pod = FactoryBot.create(:pod, status: :net_failed, offline_since: DateTime.now.utc - 15.days)
|
||||
offline_person = FactoryBot.create(:person, pod: offline_pod)
|
||||
|
||||
expect(Workers::SendPublic).to receive(:perform_async) do |user_id, _entity_string, urls, xml|
|
||||
expect(user_id).to eq(alice.id)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user