about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-18 23:08:52 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-18 23:10:44 +0100
commit7b7bf834e9f8616440259fcee518fa11adf3e457 (patch)
treee5a5d88f26c162606b4624bd78d644096cf6399a /spec/controllers
parent1fd2ac774f77dbca25a1bf82279e2eafa8a3d83b (diff)
Fix OAuth authorization page and add a spec for it
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/about_controller_spec.rb7
-rw-r--r--spec/controllers/home_controller_spec.rb2
-rw-r--r--spec/controllers/oauth/authorizations_controller_spec.rb25
-rw-r--r--spec/controllers/tags_controller_spec.rb2
4 files changed, 35 insertions, 1 deletions
diff --git a/spec/controllers/about_controller_spec.rb b/spec/controllers/about_controller_spec.rb
index 4fb58637a..4282649e1 100644
--- a/spec/controllers/about_controller_spec.rb
+++ b/spec/controllers/about_controller_spec.rb
@@ -1,6 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe AboutController, type: :controller do
+  render_views
 
   describe 'GET #index' do
     it 'returns http success' do
@@ -9,4 +10,10 @@ RSpec.describe AboutController, type: :controller do
     end
   end
 
+  describe 'GET #terms' do
+    it 'returns http success' do
+      get :terms
+      expect(response).to have_http_status(:success)
+    end
+  end
 end
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index ec2e3b67c..0215495b7 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe HomeController, type: :controller do
+  render_views
+
   describe 'GET #index' do
     it 'redirects to about page' do
       get :index
diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb
new file mode 100644
index 000000000..0e3b34bf0
--- /dev/null
+++ b/spec/controllers/oauth/authorizations_controller_spec.rb
@@ -0,0 +1,25 @@
+require 'rails_helper'
+
+RSpec.describe Oauth::AuthorizationsController, type: :controller do
+  render_views
+
+  let(:app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/') }
+
+  before do
+    sign_in Fabricate(:user), scope: :user
+  end
+
+  describe 'GET #new' do
+    before do
+      get :new, params: { client_id: app.uid, response_type: 'code', redirect_uri: 'http://localhost/' }
+    end
+
+    it 'returns http success' do
+      expect(response).to have_http_status(:success)
+    end
+
+    it 'gives options to authorize and deny' do
+      expect(response.body).to match(/Authorize/)
+    end
+  end
+end
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb
index 92e25e03b..80007ecda 100644
--- a/spec/controllers/tags_controller_spec.rb
+++ b/spec/controllers/tags_controller_spec.rb
@@ -1,6 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe TagsController, type: :controller do
+  render_views
 
   describe 'GET #show' do
     before do
@@ -12,5 +13,4 @@ RSpec.describe TagsController, type: :controller do
       expect(response).to have_http_status(:success)
     end
   end
-
 end