mirror of
https://github.com/diaspora/diaspora.git
synced 2026-01-09 15:18:11 -05:00
Merge pull request #8403 from SuperTux88/cleanup-duplicate-pods-for-real-this-time
Cleanup duplicate pods
This commit is contained in:
@@ -249,6 +249,7 @@ FactoryBot.define do
|
||||
|
||||
factory :pod do
|
||||
sequence(:host) {|n| "pod#{n}.example#{r_str}.com" }
|
||||
port { -1 }
|
||||
ssl { true }
|
||||
end
|
||||
|
||||
|
||||
@@ -30,11 +30,13 @@ describe("app.views.PodEntry", function() {
|
||||
this.pod.set({
|
||||
status: "no_errors",
|
||||
ssl: true,
|
||||
host: "pod.example.com"
|
||||
host: "pod.example.com",
|
||||
port: -1
|
||||
});
|
||||
var actual = this.view.presenter();
|
||||
expect(actual).toEqual(jasmine.objectContaining({
|
||||
/* jshint camelcase: false */
|
||||
hasPort: false,
|
||||
is_unchecked: false,
|
||||
has_no_errors: true,
|
||||
has_errors: false,
|
||||
|
||||
@@ -16,26 +16,36 @@ describe Pod, type: :model do
|
||||
it "ignores default ports" do
|
||||
pod = Pod.find_or_create_by(url: "https://example.org:443/")
|
||||
expect(pod.host).to eq("example.org")
|
||||
expect(pod.port).to be_nil
|
||||
expect(pod.port).to eq(Pod::DEFAULT_PORT)
|
||||
end
|
||||
|
||||
it "sets ssl boolean" do
|
||||
pod = Pod.find_or_create_by(url: "https://example.org/")
|
||||
expect(pod.ssl).to be true
|
||||
expect(pod.port).to eq(Pod::DEFAULT_PORT)
|
||||
end
|
||||
|
||||
it "updates ssl boolean if upgraded to https" do
|
||||
pod = Pod.find_or_create_by(url: "http://example.org/")
|
||||
expect(pod.ssl).to be false
|
||||
expect(pod.port).to eq(Pod::DEFAULT_PORT)
|
||||
pod = Pod.find_or_create_by(url: "https://example.org/")
|
||||
expect(pod.ssl).to be true
|
||||
expect(pod.port).to eq(Pod::DEFAULT_PORT)
|
||||
end
|
||||
|
||||
it "does not update ssl boolean if downgraded to http" do
|
||||
pod = Pod.find_or_create_by(url: "https://example.org/")
|
||||
expect(pod.ssl).to be true
|
||||
expect(pod.port).to eq(Pod::DEFAULT_PORT)
|
||||
pod = Pod.find_or_create_by(url: "http://example.org/")
|
||||
expect(pod.ssl).to be true
|
||||
expect(pod.port).to eq(Pod::DEFAULT_PORT)
|
||||
end
|
||||
|
||||
it "normalizes hostname to lowercase" do
|
||||
pod = Pod.find_or_create_by(url: "https://eXaMpLe.oRg/")
|
||||
expect(pod.host).to eq("example.org")
|
||||
end
|
||||
|
||||
context "validation" do
|
||||
@@ -205,6 +215,11 @@ describe Pod, type: :model do
|
||||
pod = FactoryBot.create(:pod)
|
||||
expect(pod.url_to("/receive/public")).to eq("https://#{pod.host}/receive/public")
|
||||
end
|
||||
|
||||
it "includes non-default port in pod url" do
|
||||
pod = FactoryBot.create(:pod, port: 3000)
|
||||
expect(pod.url_to("/receive/public")).to eq("https://#{pod.host}:#{pod.port}/receive/public")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update_offline_since" do
|
||||
|
||||
Reference in New Issue
Block a user