about summary refs log tree commit diff
path: root/spec/controllers/api/v2
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/api/v2')
-rw-r--r--spec/controllers/api/v2/admin/accounts_controller_spec.rb4
-rw-r--r--spec/controllers/api/v2/filters/keywords_controller_spec.rb6
-rw-r--r--spec/controllers/api/v2/filters/statuses_controller_spec.rb6
-rw-r--r--spec/controllers/api/v2/filters_controller_spec.rb2
-rw-r--r--spec/controllers/api/v2/instances_controller_spec.rb22
-rw-r--r--spec/controllers/api/v2/suggestions_controller_spec.rb22
6 files changed, 57 insertions, 5 deletions
diff --git a/spec/controllers/api/v2/admin/accounts_controller_spec.rb b/spec/controllers/api/v2/admin/accounts_controller_spec.rb
index 2508a9e05..5766fd549 100644
--- a/spec/controllers/api/v2/admin/accounts_controller_spec.rb
+++ b/spec/controllers/api/v2/admin/accounts_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Api::V2::Admin::AccountsController, type: :controller do
@@ -65,7 +67,7 @@ RSpec.describe Api::V2::Admin::AccountsController, type: :controller do
         it "returns the correct accounts (#{expected_results.inspect})" do
           json = body_as_json
 
-          expect(json.map { |a| a[:id].to_i }).to eq (expected_results.map { |symbol| send(symbol).id })
+          expect(json.map { |a| a[:id].to_i }).to eq(expected_results.map { |symbol| send(symbol).id })
         end
       end
     end
diff --git a/spec/controllers/api/v2/filters/keywords_controller_spec.rb b/spec/controllers/api/v2/filters/keywords_controller_spec.rb
index 1201a4ca2..8c61059c6 100644
--- a/spec/controllers/api/v2/filters/keywords_controller_spec.rb
+++ b/spec/controllers/api/v2/filters/keywords_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
@@ -45,7 +47,7 @@ RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
     it 'returns a keyword' do
       json = body_as_json
       expect(json[:keyword]).to eq 'magic'
-      expect(json[:whole_word]).to eq false
+      expect(json[:whole_word]).to be false
     end
 
     it 'creates a keyword' do
@@ -78,7 +80,7 @@ RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
     it 'returns expected data' do
       json = body_as_json
       expect(json[:keyword]).to eq 'foo'
-      expect(json[:whole_word]).to eq false
+      expect(json[:whole_word]).to be false
     end
 
     context "when trying to access another user's filter keyword" do
diff --git a/spec/controllers/api/v2/filters/statuses_controller_spec.rb b/spec/controllers/api/v2/filters/statuses_controller_spec.rb
index 9740c1eb3..330cf45a6 100644
--- a/spec/controllers/api/v2/filters/statuses_controller_spec.rb
+++ b/spec/controllers/api/v2/filters/statuses_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
@@ -64,7 +66,7 @@ RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
   end
 
   describe 'GET #show' do
-    let(:scopes)  { 'read:filters' }
+    let(:scopes) { 'read:filters' }
     let!(:status_filter) { Fabricate(:custom_filter_status, custom_filter: filter) }
 
     before do
@@ -90,7 +92,7 @@ RSpec.describe Api::V2::Filters::StatusesController, type: :controller do
   end
 
   describe 'DELETE #destroy' do
-    let(:scopes)  { 'write:filters' }
+    let(:scopes) { 'write:filters' }
     let(:status_filter) { Fabricate(:custom_filter_status, custom_filter: filter) }
 
     before do
diff --git a/spec/controllers/api/v2/filters_controller_spec.rb b/spec/controllers/api/v2/filters_controller_spec.rb
index cc0070d57..2b5610a4d 100644
--- a/spec/controllers/api/v2/filters_controller_spec.rb
+++ b/spec/controllers/api/v2/filters_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Api::V2::FiltersController, type: :controller do
diff --git a/spec/controllers/api/v2/instances_controller_spec.rb b/spec/controllers/api/v2/instances_controller_spec.rb
new file mode 100644
index 000000000..b7206da0a
--- /dev/null
+++ b/spec/controllers/api/v2/instances_controller_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Api::V2::InstancesController do
+  render_views
+
+  let(:user)  { Fabricate(:user) }
+  let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
+
+  before do
+    allow(controller).to receive(:doorkeeper_token) { token }
+  end
+
+  describe 'GET #show' do
+    it 'returns http success' do
+      get :show
+
+      expect(response).to have_http_status(200)
+    end
+  end
+end
diff --git a/spec/controllers/api/v2/suggestions_controller_spec.rb b/spec/controllers/api/v2/suggestions_controller_spec.rb
new file mode 100644
index 000000000..5e6508bfd
--- /dev/null
+++ b/spec/controllers/api/v2/suggestions_controller_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Api::V2::SuggestionsController do
+  render_views
+
+  let(:user)  { Fabricate(:user) }
+  let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read') }
+
+  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(200)
+    end
+  end
+end