mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Adding our own custom unauthorized page
This commit is contained in:
7
app/controllers/spree/store_controller_decorator.rb
Normal file
7
app/controllers/spree/store_controller_decorator.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class Spree::StoreController
|
||||
layout 'darkswarm'
|
||||
|
||||
def unauthorized
|
||||
render 'shared/unauthorized', :status => 401
|
||||
end
|
||||
end
|
||||
1
app/views/shared/unauthorized.html.haml
Normal file
1
app/views/shared/unauthorized.html.haml
Normal file
@@ -0,0 +1 @@
|
||||
Unauthorized
|
||||
14
spec/controllers/spree/store_controller_spec.rb
Normal file
14
spec/controllers/spree/store_controller_spec.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Spree::StoreController do
|
||||
controller(Spree::StoreController) do
|
||||
before_filter :unauthorized
|
||||
def index
|
||||
render text: ""
|
||||
end
|
||||
end
|
||||
it "redirects to home when unauthorized" do
|
||||
get :index
|
||||
response.should render_template("shared/unauthorized", layout: 'darkswarm')
|
||||
end
|
||||
end
|
||||
@@ -21,14 +21,14 @@ describe 'OrderCycle service', ->
|
||||
$httpBackend.expectPOST("/shop/order_cycle", {"order_cycle_id" : 10}).respond(200)
|
||||
spyOn(mockProduct, "update")
|
||||
OrderCycle.order_cycle.order_cycle_id = 10
|
||||
OrderCycle.push_order_cycle()
|
||||
OrderCycle.push_order_cycle mockProduct.update
|
||||
$httpBackend.flush()
|
||||
expect(mockProduct.update).toHaveBeenCalled()
|
||||
|
||||
it "updates the orders_close_at attr after update", ->
|
||||
datestring = "2013-12-20T00:00:00+11:00"
|
||||
$httpBackend.expectPOST("/shop/order_cycle").respond({orders_close_at: datestring})
|
||||
OrderCycle.push_order_cycle()
|
||||
OrderCycle.push_order_cycle mockProduct.update
|
||||
$httpBackend.flush()
|
||||
expect(OrderCycle.order_cycle.orders_close_at).toEqual(datestring)
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ describe 'Order service', ->
|
||||
|
||||
inject ($injector, _$httpBackend_)->
|
||||
$httpBackend = _$httpBackend_
|
||||
$httpBackend.expectGET("/shop/products").respond 200, []
|
||||
Order = $injector.get("Order")
|
||||
Navigation = $injector.get("Navigation")
|
||||
flash = $injector.get("flash")
|
||||
|
||||
Reference in New Issue
Block a user