Commit 5ea998a3 authored by Dennis Schubert's avatar Dennis Schubert

Change 'unless' to 'if' again because 'unless' is wrong here.

Also, add some specs and add it to the changelog.
parent 4b5b7fc7
......@@ -15,6 +15,7 @@
### Other
* MessagesController. [#3657](https://github.com/diaspora/diaspora/pull/3657)
* **Fixed setting:** `follow_diasporahq` has now to be set to `true` to enable following the DiasporaHQ account. Was `false`
## Features
......
......@@ -410,7 +410,7 @@ class User < ActiveRecord::Base
self.aspects.create(:name => I18n.t('aspects.seed.work'))
aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances'))
unless AppConfig.settings.follow_diasporahq
if AppConfig.settings.follow_diasporahq?
default_account = Webfinger.new('diasporahq@joindiaspora.com').fetch
self.share_with(default_account, aq) if default_account
end
......
......@@ -870,6 +870,59 @@ describe User do
end
end
describe "#seed_aspects" do
describe "create aspects" do
let(:user) {
user = FactoryGirl.create(:user)
user.seed_aspects
user
}
[I18n.t('aspects.seed.family'), I18n.t('aspects.seed.friends'),
I18n.t('aspects.seed.work'), I18n.t('aspects.seed.acquaintances')].each do |aspect_name|
it "creates an aspect named #{aspect_name} for the user" do
user.aspects.find_by_name(aspect_name).should_not be_nil
end
end
end
describe "diasporahq sharing" do
let(:user) {
FactoryGirl.create(:user)
}
before(:each) do
@old_followhq_value = AppConfig.settings.follow_diasporahq?
end
after(:each) do
AppConfig.settings.follow_diasporahq = @old_followhq_value
end
context "with sharing with diasporahq enabled" do
it "should start sharing with the diasporahq account" do
AppConfig.settings.follow_diasporahq = true
wf_mock = mock
wf_mock.should_receive(:fetch)
Webfinger.should_receive(:new).and_return(wf_mock)
user.seed_aspects
end
end
context "with sharing with diasporahq enabled" do
it "should not start sharing with the diasporahq account" do
AppConfig.settings.follow_diasporahq = false
Webfinger.should_not_receive(:new)
user.seed_aspects
end
end
end
end
context "close account" do
before do
@user = bob
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment