spec/utopia/controller/rewrite_spec.rb in utopia-1.1.0 vs spec/utopia/controller/rewrite_spec.rb in utopia-1.1.1

- old
+ new

@@ -38,10 +38,14 @@ rewrite.extract_prefix user_id: Integer, summary: 'summary', order_id: Integer attr :user_id attr :order_id + rewrite.extract_prefix fail: 'fail' do + fail! 444 + end + def self.uri_path Utopia::Path['/'] end end @@ -59,8 +63,17 @@ controller.process!(request, relative_path) expect(controller.user_id).to be == 10 expect(controller.order_id).to be == 20 expect(controller.edit).to be true + end + + it "should allow rewrite to fail request" do + request, path, variables = mock_request("/fail") + relative_path = path - controller.class.uri_path + + response = controller.process!(request, relative_path) + + expect(response[0]).to be == 444 end end end