Change 'unless' to 'if' again because 'unless' is wrong here.
Also, add some specs and add it to the changelog.
This commit is contained in:
parent
4b5b7fc77f
commit
5ea998a382
3 changed files with 55 additions and 1 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
### Other
|
### Other
|
||||||
|
|
||||||
* MessagesController. [#3657](https://github.com/diaspora/diaspora/pull/3657)
|
* 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
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,7 @@ class User < ActiveRecord::Base
|
||||||
self.aspects.create(:name => I18n.t('aspects.seed.work'))
|
self.aspects.create(:name => I18n.t('aspects.seed.work'))
|
||||||
aq = self.aspects.create(:name => I18n.t('aspects.seed.acquaintances'))
|
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
|
default_account = Webfinger.new('diasporahq@joindiaspora.com').fetch
|
||||||
self.share_with(default_account, aq) if default_account
|
self.share_with(default_account, aq) if default_account
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -870,6 +870,59 @@ describe User do
|
||||||
end
|
end
|
||||||
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
|
context "close account" do
|
||||||
before do
|
before do
|
||||||
@user = bob
|
@user = bob
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue