diff --git a/.travis.yml b/.travis.yml index 3d1866a2b..da91cff88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,22 @@ language: ruby - rvm: - - 2.0.0 - +- 2.0.0 services: - - mongodb - - redis-server - - elasticsearch - +- mongodb +- redis-server +- elasticsearch before_script: - - rake db:mongoid:create_indexes - +- rake db:mongoid:create_indexes notifications: campfire: rooms: - - secure: "eEuzoYFXLPeIMt+zHGzZp6XCvbfxRDe8FA3kVwrNRB0zoOktPRZXD9O8ng2z\nx2Yg8C7i1unstuW0bjPvwphpdxJOTFSxliw6P4Xk1Y9HnTYQqqUbDat/zL9c\nAyjYezuRQgYFSBP2BgNZ2RL9RiLSyLQBWhcHGB0yBS6rsheKWbk=" + - secure: |- + eEuzoYFXLPeIMt+zHGzZp6XCvbfxRDe8FA3kVwrNRB0zoOktPRZXD9O8ng2z + x2Yg8C7i1unstuW0bjPvwphpdxJOTFSxliw6P4Xk1Y9HnTYQqqUbDat/zL9c + AyjYezuRQgYFSBP2BgNZ2RL9RiLSyLQBWhcHGB0yBS6rsheKWbk= on_success: never on_failure: always - webhooks: http://cfa-project-monitor.herokuapp.com/projects/f4e235b6-734e-4d63-a19b-32426335c047/status \ No newline at end of file + webhooks: http://cfa-project-monitor.herokuapp.com/projects/f4e235b6-734e-4d63-a19b-32426335c047/status +env: + matrix: + secure: SyAQm64busWPLwPPdpebaH3QIaK7acP8j7eIj449kI+KYSkTEj5G+ir/Nu1z0XLGv50vmezdg8FsKBe32Bi5c5f1I5rRLsTI9K/lN10OYh6ZzERoTTsypjx+s9xQ1NRPzamMGEpcxG2iOU/n2KU3CPW4BPIp9dpmhUFZ3Obk71Q= diff --git a/spec/api/locations_spec.rb b/spec/api/locations_spec.rb index ec4158de9..b2d02b313 100644 --- a/spec/api/locations_spec.rb +++ b/spec/api/locations_spec.rb @@ -555,5 +555,15 @@ end end + describe "Update a location without a valid token" do + it "doesn't allow updating a location witout a valid token" do + @loc = create(:location) + put "api/locations/#{@loc.id}", { :name => "new name" }, + { 'HTTP_X_API_TOKEN' => "invalid_token" } + @loc.reload + expect(response.status).to eq(401) + end + end + end end \ No newline at end of file diff --git a/spec/api/services_spec.rb b/spec/api/services_spec.rb index 07b72b001..9e195882e 100644 --- a/spec/api/services_spec.rb +++ b/spec/api/services_spec.rb @@ -56,7 +56,16 @@ expect(response.status).to eq(400) json["message"].should include "Service areas must be an array" end + end + describe "Update a service without a valid token" do + it "doesn't allow updating a service witout a valid token" do + service = create(:service) + put "api/services/#{service.id}", { :name => "new name" }, + { 'HTTP_X_API_TOKEN' => "invalid_token" } + service.reload + expect(response.status).to eq(401) + end end end