Commit a0e14657f088686c88a01e149a4a0bb1760eb37d
1 parent
17cfce31
Exists in
master
and in
1 other branch
Update some gem in their patch-level version
Use Nokogiri to parse XML and see if it's valid XML
Showing
5 changed files
with
77 additions
and
85 deletions
Show diff stats
Gemfile
| ... | ... | @@ -8,9 +8,6 @@ gem 'haml' |
| 8 | 8 | gem 'htmlentities', "~> 4.3.0" |
| 9 | 9 | gem 'rack-ssl', :require => 'rack/ssl' # force SSL |
| 10 | 10 | |
| 11 | -# Remove this when tilt 1.3.7 is released. | |
| 12 | -gem 'tilt', :git => 'https://github.com/rtomayko/tilt.git' | |
| 13 | - | |
| 14 | 11 | gem 'useragent', '~> 0.4.16' |
| 15 | 12 | gem 'inherited_resources' |
| 16 | 13 | gem 'SystemTimer', :platform => :ruby_18 | ... | ... |
Gemfile.lock
| ... | ... | @@ -5,12 +5,6 @@ GIT |
| 5 | 5 | gitlab (2.2.0) |
| 6 | 6 | httparty |
| 7 | 7 | |
| 8 | -GIT | |
| 9 | - remote: https://github.com/rtomayko/tilt.git | |
| 10 | - revision: 74618967fbed3e206453516b92b47cd9aa922903 | |
| 11 | - specs: | |
| 12 | - tilt (1.4.0) | |
| 13 | - | |
| 14 | 8 | GEM |
| 15 | 9 | remote: http://rubygems.org/ |
| 16 | 10 | specs: |
| ... | ... | @@ -46,32 +40,33 @@ GEM |
| 46 | 40 | activesupport (3.2.13) |
| 47 | 41 | i18n (= 0.6.1) |
| 48 | 42 | multi_json (~> 1.0) |
| 49 | - addressable (2.3.2) | |
| 43 | + addressable (2.3.4) | |
| 50 | 44 | airbrake (3.1.12) |
| 51 | 45 | activesupport |
| 52 | 46 | builder |
| 53 | 47 | json |
| 54 | 48 | arel (3.0.2) |
| 55 | 49 | bcrypt-ruby (3.0.1) |
| 56 | - better_errors (0.7.0) | |
| 50 | + better_errors (0.8.0) | |
| 57 | 51 | coderay (>= 1.0.0) |
| 58 | 52 | erubis (>= 2.6.6) |
| 59 | 53 | binding_of_caller (0.7.1) |
| 60 | 54 | debug_inspector (>= 0.0.1) |
| 61 | - bitbucket_rest_api (0.1.1) | |
| 55 | + bitbucket_rest_api (0.1.2) | |
| 62 | 56 | faraday (~> 0.8.1) |
| 63 | 57 | faraday_middleware (~> 0.8.1) |
| 64 | 58 | hashie (~> 1.2.0) |
| 65 | 59 | multi_json (~> 1.3) |
| 66 | 60 | nokogiri (~> 1.5.2) |
| 67 | 61 | simple_oauth |
| 68 | - bson (1.8.5) | |
| 69 | - bson_ext (1.8.5) | |
| 70 | - bson (~> 1.8.5) | |
| 62 | + bson (1.8.6) | |
| 63 | + bson_ext (1.8.6) | |
| 64 | + bson (~> 1.8.6) | |
| 71 | 65 | builder (3.0.4) |
| 66 | + callsite (0.0.11) | |
| 72 | 67 | campy (0.1.3) |
| 73 | 68 | multi_json (~> 1.0) |
| 74 | - capistrano (2.13.5) | |
| 69 | + capistrano (2.15.4) | |
| 75 | 70 | highline |
| 76 | 71 | net-scp (>= 1.0.0) |
| 77 | 72 | net-sftp (>= 2.0.0) |
| ... | ... | @@ -86,12 +81,12 @@ GEM |
| 86 | 81 | xpath (~> 0.1.4) |
| 87 | 82 | childprocess (0.3.5) |
| 88 | 83 | ffi (~> 1.0, >= 1.0.6) |
| 89 | - coderay (1.0.6) | |
| 84 | + coderay (1.0.9) | |
| 90 | 85 | colorize (0.5.8) |
| 91 | 86 | columnize (0.3.6) |
| 92 | - coveralls (0.5.7) | |
| 87 | + coveralls (0.6.7) | |
| 93 | 88 | colorize |
| 94 | - json | |
| 89 | + multi_json (~> 1.3) | |
| 95 | 90 | rest-client |
| 96 | 91 | simplecov (>= 0.7) |
| 97 | 92 | thor |
| ... | ... | @@ -99,42 +94,43 @@ GEM |
| 99 | 94 | css_parser (1.2.6) |
| 100 | 95 | addressable |
| 101 | 96 | rdoc |
| 102 | - daemons (1.1.8) | |
| 97 | + daemons (1.1.9) | |
| 103 | 98 | database_cleaner (0.6.7) |
| 104 | 99 | debug_inspector (0.0.2) |
| 105 | - debugger (1.3.0) | |
| 100 | + debugger (1.6.0) | |
| 106 | 101 | columnize (>= 0.3.1) |
| 107 | - debugger-linecache (~> 1.1.1) | |
| 108 | - debugger-ruby_core_source (~> 1.1.7) | |
| 109 | - debugger-linecache (1.1.2) | |
| 110 | - debugger-ruby_core_source (>= 1.1.1) | |
| 111 | - debugger-ruby_core_source (1.1.7) | |
| 102 | + debugger-linecache (~> 1.2.0) | |
| 103 | + debugger-ruby_core_source (~> 1.2.1) | |
| 104 | + debugger-linecache (1.2.0) | |
| 105 | + debugger-ruby_core_source (1.2.2) | |
| 112 | 106 | devise (1.5.4) |
| 113 | 107 | bcrypt-ruby (~> 3.0) |
| 114 | 108 | orm_adapter (~> 0.0.3) |
| 115 | 109 | warden (~> 1.1) |
| 116 | 110 | diff-lcs (1.2.4) |
| 117 | - email_spec (1.2.1) | |
| 111 | + dotenv (0.7.0) | |
| 112 | + email_spec (1.4.0) | |
| 113 | + launchy (~> 2.1) | |
| 118 | 114 | mail (~> 2.2) |
| 119 | - rspec (~> 2.0) | |
| 120 | 115 | erubis (2.7.0) |
| 121 | 116 | eventmachine (1.0.3) |
| 122 | 117 | execjs (1.4.0) |
| 123 | 118 | multi_json (~> 1.0) |
| 124 | 119 | fabrication (1.3.2) |
| 125 | - faraday (0.8.4) | |
| 120 | + faraday (0.8.7) | |
| 126 | 121 | multipart-post (~> 1.1) |
| 127 | 122 | faraday_middleware (0.8.8) |
| 128 | 123 | faraday (>= 0.7.4, < 0.9) |
| 129 | 124 | ffi (1.1.4) |
| 130 | - foreman (0.60.2) | |
| 125 | + foreman (0.63.0) | |
| 126 | + dotenv (>= 0.7) | |
| 131 | 127 | thor (>= 0.13.6) |
| 132 | 128 | haml (3.1.7) |
| 133 | 129 | happymapper (0.4.0) |
| 134 | 130 | libxml-ruby (~> 2.0) |
| 135 | 131 | has_scope (0.5.1) |
| 136 | 132 | hashie (1.2.0) |
| 137 | - highline (1.6.15) | |
| 133 | + highline (1.6.19) | |
| 138 | 134 | hike (1.2.2) |
| 139 | 135 | hipchat (0.4.1) |
| 140 | 136 | httparty |
| ... | ... | @@ -154,35 +150,35 @@ GEM |
| 154 | 150 | has_scope (~> 0.5.0) |
| 155 | 151 | responders (~> 0.6) |
| 156 | 152 | journey (1.0.4) |
| 157 | - json (1.7.7) | |
| 153 | + json (1.8.0) | |
| 158 | 154 | jwt (0.1.5) |
| 159 | 155 | multi_json (>= 1.0) |
| 160 | 156 | kaminari (0.14.1) |
| 161 | 157 | actionpack (>= 3.0.0) |
| 162 | 158 | activesupport (>= 3.0.0) |
| 163 | 159 | kgio (2.7.4) |
| 164 | - launchy (2.1.2) | |
| 160 | + launchy (2.3.0) | |
| 165 | 161 | addressable (~> 2.3) |
| 166 | - libv8 (3.11.8.13) | |
| 162 | + libv8 (3.11.8.17) | |
| 167 | 163 | libwebsocket (0.1.5) |
| 168 | 164 | addressable |
| 169 | - libxml-ruby (2.3.3) | |
| 165 | + libxml-ruby (2.6.0) | |
| 170 | 166 | lighthouse-api (2.0) |
| 171 | 167 | activeresource (>= 3.0.0) |
| 172 | 168 | activesupport (>= 3.0.0) |
| 173 | 169 | linecache (0.46) |
| 174 | 170 | rbx-require-relative (> 0.0.4) |
| 175 | - mail (2.5.3) | |
| 176 | - i18n (>= 0.4.0) | |
| 171 | + mail (2.5.4) | |
| 177 | 172 | mime-types (~> 1.16) |
| 178 | 173 | treetop (~> 1.4.8) |
| 179 | - meta_request (0.2.2) | |
| 174 | + meta_request (0.2.5) | |
| 175 | + callsite | |
| 180 | 176 | rack-contrib |
| 181 | 177 | railties |
| 182 | - method_source (0.7.1) | |
| 183 | - mime-types (1.21) | |
| 184 | - mongo (1.8.5) | |
| 185 | - bson (~> 1.8.5) | |
| 178 | + method_source (0.8.1) | |
| 179 | + mime-types (1.23) | |
| 180 | + mongo (1.8.6) | |
| 181 | + bson (~> 1.8.6) | |
| 186 | 182 | mongoid (2.7.1) |
| 187 | 183 | activemodel (~> 3.1) |
| 188 | 184 | mongo (~> 1.8) |
| ... | ... | @@ -193,16 +189,18 @@ GEM |
| 193 | 189 | rails (>= 3.0.0) |
| 194 | 190 | railties (>= 3.0.0) |
| 195 | 191 | multi_json (1.7.3) |
| 196 | - multi_xml (0.5.2) | |
| 197 | - multipart-post (1.1.5) | |
| 198 | - net-scp (1.0.4) | |
| 199 | - net-ssh (>= 1.99.1) | |
| 200 | - net-sftp (2.0.5) | |
| 201 | - net-ssh (>= 2.0.9) | |
| 202 | - net-ssh (2.6.1) | |
| 203 | - net-ssh-gateway (1.1.0) | |
| 204 | - net-ssh (>= 1.99.1) | |
| 205 | - nokogiri (1.5.5) | |
| 192 | + multi_xml (0.5.3) | |
| 193 | + multipart-post (1.2.0) | |
| 194 | + net-scp (1.1.1) | |
| 195 | + net-ssh (>= 2.6.5) | |
| 196 | + net-sftp (2.1.2) | |
| 197 | + net-ssh (>= 2.6.5) | |
| 198 | + net-ssh (2.6.7) | |
| 199 | + net-ssh-gateway (1.2.0) | |
| 200 | + net-ssh (>= 2.6.5) | |
| 201 | + nokogiri (1.5.9) | |
| 202 | + nokogiri-happymapper (0.5.7) | |
| 203 | + nokogiri (~> 1.5) | |
| 206 | 204 | oauth2 (0.8.0) |
| 207 | 205 | faraday (~> 0.8) |
| 208 | 206 | httpauth (~> 0.1) |
| ... | ... | @@ -215,8 +213,8 @@ GEM |
| 215 | 213 | faraday_middleware (~> 0.8) |
| 216 | 214 | hashie (~> 1.2) |
| 217 | 215 | multi_json (~> 1.3) |
| 218 | - omniauth (1.1.1) | |
| 219 | - hashie (~> 1.2) | |
| 216 | + omniauth (1.1.4) | |
| 217 | + hashie (>= 1.2, < 3) | |
| 220 | 218 | rack |
| 221 | 219 | omniauth-github (1.0.2) |
| 222 | 220 | omniauth (~> 1.0) |
| ... | ... | @@ -227,25 +225,26 @@ GEM |
| 227 | 225 | orm_adapter (0.0.7) |
| 228 | 226 | oruen_redmine_client (0.0.1) |
| 229 | 227 | activeresource (>= 2.3.0) |
| 230 | - pivotal-tracker (0.5.4) | |
| 231 | - builder | |
| 228 | + pivotal-tracker (0.5.10) | |
| 232 | 229 | builder |
| 233 | - happymapper (>= 0.3.2) | |
| 230 | + crack | |
| 234 | 231 | happymapper (>= 0.3.2) |
| 235 | 232 | nokogiri (>= 1.4.3) |
| 236 | - nokogiri (~> 1.4) | |
| 237 | - rest-client (~> 1.6.0) | |
| 233 | + nokogiri (>= 1.5.5) | |
| 234 | + nokogiri-happymapper (>= 0.5.4) | |
| 238 | 235 | rest-client (~> 1.6.0) |
| 239 | 236 | polyglot (0.3.3) |
| 240 | 237 | premailer (1.7.3) |
| 241 | 238 | css_parser (>= 1.1.9) |
| 242 | 239 | htmlentities (>= 4.0.0) |
| 243 | - pry (0.9.9.6) | |
| 240 | + pry (0.9.12.2) | |
| 244 | 241 | coderay (~> 1.0.5) |
| 245 | - method_source (~> 0.7.1) | |
| 246 | - slop (>= 2.4.4, < 3) | |
| 247 | - pry-rails (0.2.0) | |
| 248 | - pry | |
| 242 | + method_source (~> 0.8) | |
| 243 | + slop (~> 3.4) | |
| 244 | + pry-rails (0.3.0) | |
| 245 | + pry (>= 0.9.10) | |
| 246 | + puma (2.0.1) | |
| 247 | + rack (>= 1.1, < 2.0) | |
| 249 | 248 | rack (1.4.5) |
| 250 | 249 | rack-cache (1.2) |
| 251 | 250 | rack (>= 0.4) |
| ... | ... | @@ -253,7 +252,7 @@ GEM |
| 253 | 252 | rack (>= 0.9.1) |
| 254 | 253 | rack-ssl (1.3.3) |
| 255 | 254 | rack |
| 256 | - rack-ssl-enforcer (0.2.4) | |
| 255 | + rack-ssl-enforcer (0.2.5) | |
| 257 | 256 | rack-test (0.6.2) |
| 258 | 257 | rack (>= 1.0) |
| 259 | 258 | rails (3.2.13) |
| ... | ... | @@ -278,21 +277,17 @@ GEM |
| 278 | 277 | rbx-require-relative (0.0.9) |
| 279 | 278 | rdoc (3.12.2) |
| 280 | 279 | json (~> 1.4) |
| 281 | - ref (1.0.2) | |
| 280 | + ref (1.0.4) | |
| 282 | 281 | responders (0.9.2) |
| 283 | 282 | railties (~> 3.1) |
| 284 | 283 | rest-client (1.6.7) |
| 285 | 284 | mime-types (>= 1.16) |
| 286 | 285 | ri_cal (0.8.8) |
| 287 | - rspec (2.13.0) | |
| 288 | - rspec-core (~> 2.13.0) | |
| 289 | - rspec-expectations (~> 2.13.0) | |
| 290 | - rspec-mocks (~> 2.13.0) | |
| 291 | 286 | rspec-core (2.13.1) |
| 292 | 287 | rspec-expectations (2.13.0) |
| 293 | 288 | diff-lcs (>= 1.1.3, < 2.0) |
| 294 | 289 | rspec-mocks (2.13.1) |
| 295 | - rspec-rails (2.13.1) | |
| 290 | + rspec-rails (2.13.2) | |
| 296 | 291 | actionpack (>= 3.0) |
| 297 | 292 | activesupport (>= 3.0) |
| 298 | 293 | railties (>= 3.0) |
| ... | ... | @@ -315,12 +310,12 @@ GEM |
| 315 | 310 | libwebsocket (~> 0.1.3) |
| 316 | 311 | multi_json (~> 1.0) |
| 317 | 312 | rubyzip |
| 318 | - simple_oauth (0.1.9) | |
| 313 | + simple_oauth (0.2.0) | |
| 319 | 314 | simplecov (0.7.1) |
| 320 | 315 | multi_json (~> 1.0) |
| 321 | 316 | simplecov-html (~> 0.7.1) |
| 322 | 317 | simplecov-html (0.7.1) |
| 323 | - slop (2.4.4) | |
| 318 | + slop (3.4.5) | |
| 324 | 319 | sprockets (2.2.2) |
| 325 | 320 | hike (~> 1.2) |
| 326 | 321 | multi_json (~> 1.0) |
| ... | ... | @@ -329,12 +324,13 @@ GEM |
| 329 | 324 | therubyracer (0.11.4) |
| 330 | 325 | libv8 (~> 3.11.8.12) |
| 331 | 326 | ref |
| 332 | - thin (1.4.1) | |
| 327 | + thin (1.5.1) | |
| 333 | 328 | daemons (>= 1.0.9) |
| 334 | 329 | eventmachine (>= 0.12.6) |
| 335 | 330 | rack (>= 1.0.0) |
| 336 | 331 | thor (0.18.1) |
| 337 | - timecop (0.3.5) | |
| 332 | + tilt (1.4.1) | |
| 333 | + timecop (0.6.1) | |
| 338 | 334 | treetop (1.4.12) |
| 339 | 335 | polyglot |
| 340 | 336 | polyglot (>= 0.3.1) |
| ... | ... | @@ -353,9 +349,9 @@ GEM |
| 353 | 349 | useragent (0.4.16) |
| 354 | 350 | warden (1.2.1) |
| 355 | 351 | rack (>= 1.0) |
| 356 | - webmock (1.8.7) | |
| 352 | + webmock (1.11.0) | |
| 357 | 353 | addressable (>= 2.2.7) |
| 358 | - crack (>= 0.1.7) | |
| 354 | + crack (>= 0.3.2) | |
| 359 | 355 | xmpp4r (0.5) |
| 360 | 356 | xpath (0.1.4) |
| 361 | 357 | nokogiri (~> 1.3) |
| ... | ... | @@ -415,7 +411,6 @@ DEPENDENCIES |
| 415 | 411 | rushover |
| 416 | 412 | therubyracer |
| 417 | 413 | thin |
| 418 | - tilt! | |
| 419 | 414 | timecop |
| 420 | 415 | turbo-sprockets-rails3 |
| 421 | 416 | uglifier (>= 1.0.3) | ... | ... |
app/controllers/api/v1/notices_controller.rb
| 1 | 1 | class Api::V1::NoticesController < ApplicationController |
| 2 | 2 | respond_to :json, :xml |
| 3 | - | |
| 3 | + | |
| 4 | 4 | def index |
| 5 | 5 | query = {} |
| 6 | 6 | fields = %w{created_at message error_class} |
| 7 | - | |
| 7 | + | |
| 8 | 8 | if params.key?(:start_date) && params.key?(:end_date) |
| 9 | 9 | start_date = Time.parse(params[:start_date]).utc |
| 10 | 10 | end_date = Time.parse(params[:end_date]).utc |
| 11 | 11 | query = {:created_at => {"$lte" => end_date, "$gte" => start_date}} |
| 12 | 12 | end |
| 13 | - | |
| 13 | + | |
| 14 | 14 | results = benchmark("[api/v1/notices_controller] query time") { Mongoid.master["notices"].find(query, :fields => fields).to_a } |
| 15 | - | |
| 15 | + | |
| 16 | 16 | respond_to do |format| |
| 17 | 17 | format.html { render :json => Yajl.dump(results) } # render JSON if no extension specified on path |
| 18 | 18 | format.json { render :json => Yajl.dump(results) } |
| 19 | 19 | format.xml { render :xml => results } |
| 20 | 20 | end |
| 21 | 21 | end |
| 22 | - | |
| 22 | + | |
| 23 | 23 | end | ... | ... |
spec/controllers/api/v1/notices_controller_spec.rb
| ... | ... | @@ -22,7 +22,7 @@ describe Api::V1::NoticesController do |
| 22 | 22 | |
| 23 | 23 | it "should return XML if XML is requested" do |
| 24 | 24 | get :index, :auth_token => @user.authentication_token, :format => "xml" |
| 25 | - lambda { XML::Parser.string(response.body).parse }.should_not raise_error | |
| 25 | + Nokogiri::XML(response.body).errors.should be_empty | |
| 26 | 26 | end |
| 27 | 27 | |
| 28 | 28 | it "should return JSON by default" do | ... | ... |
spec/controllers/api/v1/problems_controller_spec.rb
| ... | ... | @@ -24,7 +24,7 @@ describe Api::V1::ProblemsController do |
| 24 | 24 | |
| 25 | 25 | it "should return XML if XML is requested" do |
| 26 | 26 | get :index, :auth_token => @user.authentication_token, :format => "xml" |
| 27 | - lambda { XML::Parser.string(response.body).parse }.should_not raise_error | |
| 27 | + Nokogiri::XML(response.body).errors.should be_empty | |
| 28 | 28 | end |
| 29 | 29 | |
| 30 | 30 | it "should return JSON by default" do | ... | ... |