about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/v1/accounts_controller_spec.rb1
-rw-r--r--spec/controllers/api/v1/blocks_controller_spec.rb19
-rw-r--r--spec/controllers/api/v1/favourites_controller_spec.rb19
-rw-r--r--spec/controllers/api/v1/follow_requests_controller_spec.rb52
-rw-r--r--spec/controllers/api/v1/statuses_controller_spec.rb1
-rw-r--r--spec/controllers/api/v1/timelines_controller_spec.rb1
-rw-r--r--spec/controllers/authorize_follow_controller_spec.rb6
-rw-r--r--spec/controllers/follow_requests_controller_spec.rb16
-rw-r--r--spec/helpers/api/oembed_helper_spec.rb15
-rw-r--r--spec/helpers/authorize_follow_helper_spec.rb5
-rw-r--r--spec/helpers/follow_requests_helper_spec.rb5
11 files changed, 101 insertions, 39 deletions
diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb
index e4532305b..98b284f7a 100644
--- a/spec/controllers/api/v1/accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts_controller_spec.rb
@@ -7,7 +7,6 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
   let(:token) { double acceptable?: true, resource_owner_id: user.id }
 
   before do
-    stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
     allow(controller).to receive(:doorkeeper_token) { token }
   end
 
diff --git a/spec/controllers/api/v1/blocks_controller_spec.rb b/spec/controllers/api/v1/blocks_controller_spec.rb
new file mode 100644
index 000000000..ca20a2d17
--- /dev/null
+++ b/spec/controllers/api/v1/blocks_controller_spec.rb
@@ -0,0 +1,19 @@
+require 'rails_helper'
+
+RSpec.describe Api::V1::BlocksController, type: :controller do
+  render_views
+
+  let(:user)  { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
+  let(:token) { double acceptable?: true, resource_owner_id: user.id }
+
+  before do
+    allow(controller).to receive(:doorkeeper_token) { token }
+  end
+
+  describe 'GET #index' do
+    it 'returns http success' do
+      get :index
+      expect(response).to have_http_status(:success)
+    end
+  end
+end
diff --git a/spec/controllers/api/v1/favourites_controller_spec.rb b/spec/controllers/api/v1/favourites_controller_spec.rb
new file mode 100644
index 000000000..a6e9963e5
--- /dev/null
+++ b/spec/controllers/api/v1/favourites_controller_spec.rb
@@ -0,0 +1,19 @@
+require 'rails_helper'
+
+RSpec.describe Api::V1::FavouritesController, type: :controller do
+  render_views
+
+  let(:user)  { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
+  let(:token) { double acceptable?: true, resource_owner_id: user.id }
+
+  before do
+    allow(controller).to receive(:doorkeeper_token) { token }
+  end
+
+  describe 'GET #index' do
+    it 'returns http success' do
+      get :index
+      expect(response).to have_http_status(:success)
+    end
+  end
+end
diff --git a/spec/controllers/api/v1/follow_requests_controller_spec.rb b/spec/controllers/api/v1/follow_requests_controller_spec.rb
new file mode 100644
index 000000000..a90d2d290
--- /dev/null
+++ b/spec/controllers/api/v1/follow_requests_controller_spec.rb
@@ -0,0 +1,52 @@
+require 'rails_helper'
+
+RSpec.describe Api::V1::FollowRequestsController, type: :controller do
+  render_views
+
+  let(:user)     { Fabricate(:user, account: Fabricate(:account, username: 'alice', locked: true)) }
+  let(:token)    { double acceptable?: true, resource_owner_id: user.id }
+  let(:follower) { Fabricate(:account, username: 'bob') }
+
+  before do
+    FollowService.new.call(follower, user.account.acct)
+    allow(controller).to receive(:doorkeeper_token) { token }
+  end
+
+  describe 'GET #index' do
+    before do
+      get :index
+    end
+
+    it 'returns http success' do
+      expect(response).to have_http_status(:success)
+    end
+  end
+
+  describe 'POST #authorize' do
+    before do
+      post :authorize, params: { id: follower.id }
+    end
+
+    it 'returns http success' do
+      expect(response).to have_http_status(:success)
+    end
+
+    it 'allows follower to follow' do
+      expect(follower.following?(user.account)).to be true
+    end
+  end
+
+  describe 'POST #reject' do
+    before do
+      post :reject, params: { id: follower.id }
+    end
+
+    it 'returns http success' do
+      expect(response).to have_http_status(:success)
+    end
+
+    it 'removes follow request' do
+      expect(FollowRequest.where(target_account: user.account, account: follower).count).to eq 0
+    end
+  end
+end
diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb
index ab918fe50..d9c73f952 100644
--- a/spec/controllers/api/v1/statuses_controller_spec.rb
+++ b/spec/controllers/api/v1/statuses_controller_spec.rb
@@ -7,7 +7,6 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
   let(:token) { double acceptable?: true, resource_owner_id: user.id }
 
   before do
-    stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
     allow(controller).to receive(:doorkeeper_token) { token }
   end
 
diff --git a/spec/controllers/api/v1/timelines_controller_spec.rb b/spec/controllers/api/v1/timelines_controller_spec.rb
index c94519ac5..5e9954baf 100644
--- a/spec/controllers/api/v1/timelines_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines_controller_spec.rb
@@ -6,7 +6,6 @@ RSpec.describe Api::V1::TimelinesController, type: :controller do
   let(:user)  { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
 
   before do
-    stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
     allow(controller).to receive(:doorkeeper_token) { token }
   end
 
diff --git a/spec/controllers/authorize_follow_controller_spec.rb b/spec/controllers/authorize_follow_controller_spec.rb
new file mode 100644
index 000000000..954efd53e
--- /dev/null
+++ b/spec/controllers/authorize_follow_controller_spec.rb
@@ -0,0 +1,6 @@
+require 'rails_helper'
+
+RSpec.describe AuthorizeFollowController, type: :controller do
+  describe 'GET #new'
+  describe 'POST #create'
+end
diff --git a/spec/controllers/follow_requests_controller_spec.rb b/spec/controllers/follow_requests_controller_spec.rb
deleted file mode 100644
index 72f5fd9b9..000000000
--- a/spec/controllers/follow_requests_controller_spec.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe FollowRequestsController, type: :controller do
-  render_views
-
-  before do
-    sign_in Fabricate(:user), scope: :user
-  end
-
-  describe 'GET #index' do
-    it 'returns http success' do
-      get :index
-      expect(response).to have_http_status(:success)
-    end
-  end
-end
diff --git a/spec/helpers/api/oembed_helper_spec.rb b/spec/helpers/api/oembed_helper_spec.rb
deleted file mode 100644
index 4f64cb84f..000000000
--- a/spec/helpers/api/oembed_helper_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'rails_helper'
-
-# Specs in this file have access to a helper object that includes
-# the Api::OembedHelper. For example:
-#
-# describe Api::OembedHelper do
-#   describe "string concat" do
-#     it "concats two strings with spaces" do
-#       expect(helper.concat_strings("this","that")).to eq("this that")
-#     end
-#   end
-# end
-RSpec.describe Api::OembedHelper, type: :helper do
-  pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/helpers/authorize_follow_helper_spec.rb b/spec/helpers/authorize_follow_helper_spec.rb
new file mode 100644
index 000000000..ba5b0a70b
--- /dev/null
+++ b/spec/helpers/authorize_follow_helper_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe AuthorizeFollowHelper, type: :helper do
+
+end
diff --git a/spec/helpers/follow_requests_helper_spec.rb b/spec/helpers/follow_requests_helper_spec.rb
deleted file mode 100644
index e031cf402..000000000
--- a/spec/helpers/follow_requests_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe FollowRequestsHelper, type: :helper do
-
-end