aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/api_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/api_controller_spec.rb')
-rw-r--r--spec/controllers/api_controller_spec.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb
index 8e9d17fbe..6b02bd5b4 100644
--- a/spec/controllers/api_controller_spec.rb
+++ b/spec/controllers/api_controller_spec.rb
@@ -1,18 +1,6 @@
# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-def normalise_whitespace(s)
- s = s.gsub(/\A\s+|\s+\Z/, "")
- s = s.gsub(/\s+/, " ")
- return s
-end
-
-RSpec::Matchers.define :be_equal_modulo_whitespace_to do |expected|
- match do |actual|
- normalise_whitespace(actual) == normalise_whitespace(expected)
- end
-end
-
describe ApiController, "when using the API" do
describe 'checking API keys' do
@@ -282,6 +270,18 @@ describe ApiController, "when using the API" do
# check, which does not really test anything at all.
end
+ it 'should show information about an external request' do
+ info_request = info_requests(:external_request)
+ get :show_request,
+ :k => public_bodies(:geraldine_public_body).api_key,
+ :id => info_request.id
+
+ response.should be_success
+ assigns[:request].id.should == info_request.id
+ r = ActiveSupport::JSON.decode(response.body)
+ r["title"].should == info_request.title
+ end
+
it "should show an Atom feed of new request events" do
get :body_request_events,
:id => public_bodies(:geraldine_public_body).id,