say('The specified account is not redirecting to its last migration target. Use --force if you want to replay the migration anyway',:red)
exit(1)
end
fail_with_message'The specified account is not redirecting to its last migration target. Use --force if you want to replay the migration anyway'unlessoptions[:force]||migration.target_account_id==account.moved_to_account_id
say('The specified account is redirecting to a different target account. Use --force if you want to change the migration target',:red)
exit(1)
end
fail_with_message'The specified account is redirecting to a different target account. Use --force if you want to change the migration target'unlessoptions[:force]||account.moved_to_account_id.nil?||account.moved_to_account_id==target_account.id
say('--include-follows can only be used with --prune-profiles or --remove-headers',:red,true)
exit(1)
end
fail_with_message'--include-follows can only be used with --prune-profiles or --remove-headers'ifoptions[:include_follows]&&!(options[:prune_profiles]||options[:remove_headers])
@ -892,8 +877,7 @@ describe Mastodon::CLI::Accounts do
context'when neither a list of accts nor options are provided'do
it'exits with an error message'do
expect{subject}
.tooutput_results('No account(s) given')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'No account(s) given')
end
end
end
@ -904,8 +888,7 @@ describe Mastodon::CLI::Accounts do
context'when neither username nor --all option are given'do
it'exits with an error message'do
expect{subject}
.tooutput_results('No account(s) given')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'No account(s) given')
end
end
@ -940,8 +923,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message when the specified username is not found'do
expect{subject}
.tooutput_results('No such account')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'No such account')
end
end
@ -980,8 +962,7 @@ describe Mastodon::CLI::Accounts do
shared_examples'an account not found'do|acct|
it'exits with an error message indicating that there is no such account'do
expect{subject}
.tooutput_results("No such account (#{acct})")
.andraise_error(SystemExit)
.toraise_error(Thor::Error,"No such account (#{acct})")
end
end
@ -1031,8 +1012,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message indicating that the accounts do not have the same pub key'do
expect{subject}
.tooutput_results("Accounts don't have the same public key, might not be duplicates!\nOverride with --force")
.andraise_error(SystemExit)
.toraise_error(Thor::Error,"Accounts don't have the same public key, might not be duplicates!\nOverride with --force\n")
end
context'with --force option'do
@ -1200,8 +1180,7 @@ describe Mastodon::CLI::Accounts do
context'when no option is given'do
it'exits with an error message indicating that at least one option is required'do
expect{subject}
.tooutput_results('Please specify either --follows or --followers, or both')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'Please specify either --follows or --followers, or both')
end
end
@ -1211,8 +1190,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message indicating that there is no such account'do
expect{subject}
.tooutput_results('No such account')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'No such account')
end
end
@ -1368,16 +1346,14 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message indicating that using both options is not possible'do
expect{subject}
.tooutput_results('Use --replay or --target, not both')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'Use --replay or --target, not both')
end
end
context'when no option is given'do
it'exits with an error message indicating that at least one option must be used'do
expect{subject}
.tooutput_results('Use either --replay or --target')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'Use either --replay or --target')
end
end
@ -1387,8 +1363,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message indicating that there is no such account'do
expect{subject}
.tooutput_results("No such account: #{arguments.first}")
.andraise_error(SystemExit)
.toraise_error(Thor::Error,"No such account: #{arguments.first}")
end
end
@ -1398,8 +1373,7 @@ describe Mastodon::CLI::Accounts do
context'when the specified account has no previous migrations'do
it'exits with an error message indicating that the given account has no previous migrations'do
expect{subject}
.tooutput_results('The specified account has not performed any migration')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'The specified account has not performed any migration')
end
end
@ -1421,8 +1395,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message'do
expect{subject}
.tooutput_results('The specified account is not redirecting to its last migration target. Use --force if you want to replay the migration anyway')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'The specified account is not redirecting to its last migration target. Use --force if you want to replay the migration anyway')
end
end
@ -1449,8 +1422,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message indicating that there is no such account'do
expect{subject}
.tooutput_results("The specified target account could not be found: #{options[:target]}")
.andraise_error(SystemExit)
.toraise_error(Thor::Error,"The specified target account could not be found: #{options[:target]}")
end
end
@ -1474,8 +1446,7 @@ describe Mastodon::CLI::Accounts do
context'when the migration record is invalid'do
it'exits with an error indicating that the validation failed'do
@ -1486,8 +1457,7 @@ describe Mastodon::CLI::Accounts do
it'exits with an error message'do
expect{subject}
.tooutput_results('The specified account is redirecting to a different target account. Use --force if you want to change the migration target')
.andraise_error(SystemExit)
.toraise_error(Thor::Error,'The specified account is redirecting to a different target account. Use --force if you want to change the migration target')