Newer
Older
auto_follow_back
auto_follow_back_aspect_id
end
end
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
describe "queue_export" do
it "queues up a job to perform the export" do
user = FactoryGirl.create :user
expect(Workers::ExportUser).to receive(:perform_async).with(user.id)
user.queue_export
expect(user.exporting).to be_truthy
end
end
describe "perform_export!" do
it "saves a json export to the user" do
user = FactoryGirl.create :user, exporting: true
user.perform_export!
expect(user.export).to be_present
expect(user.exported_at).to be_present
expect(user.exporting).to be_falsey
expect(user.export.filename).to match /.json/
expect(ActiveSupport::Gzip.decompress(user.export.file.read)).to include user.username
end
it "compresses the result" do
user = FactoryGirl.create :user, exporting: true
expect(ActiveSupport::Gzip).to receive :compress
user.perform_export!
end
end
Jason Robinson
a validé
describe "sign up" do
before do
params = {:username => "ohai",
:email => "ohai@example.com",
:password => "password",
:password_confirmation => "password",
:captcha => "12345",
Jason Robinson
a validé
:person =>
{:profile =>
{:first_name => "O",
:last_name => "Hai"}
}
}
@user = User.build(params)
end
it "saves with captcha off" do
AppConfig.settings.captcha.enable = false
expect(@user).to receive(:save).and_return(true)
Jason Robinson
a validé
@user.sign_up
end
it "saves with captcha on" do
AppConfig.settings.captcha.enable = true
expect(@user).to receive(:save_with_captcha).and_return(true)
Jason Robinson
a validé
@user.sign_up
end
end
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
describe "maintenance" do
before do
@user = bob
AppConfig.settings.maintenance.remove_old_users.enable = true
end
it "#flags user for removal" do
remove_at = Time.now+5.days
@user.flag_for_removal(remove_at)
expect(@user.remove_after).to eq(remove_at)
end
end
describe "#auth database auth maintenance" do
before do
@user = bob
@user.remove_after = Time.now
@user.save
end
it "remove_after is cleared" do
@user.after_database_authentication
expect(@user.remove_after).to eq(nil)
end
Marc Burt
a validé
describe "total_users" do
before do
@user1 = FactoryGirl.build(:user, :username => nil)
@user1.save(:validate => false)
@user2 = FactoryGirl.create(:user)
@user2.person.closed_account = true
@user2.save
end
it "returns total_users excluding closed accounts & users without usernames" do
expect(User.total_users.count).to eq 5 #5 users from fixtures
end