addresses 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NmNlODc0MmM0NmIzNWRkNTExOTUwMWM1NDc2N2FlZDdhMmVlOGRiOQ==
5
- data.tar.gz: !binary |-
6
- NWViYTUxMmIzZTQwN2RkYmI4MjAxMjJkZTU0YWE3YTE2NjkzMmI4ZQ==
2
+ SHA1:
3
+ metadata.gz: 0b392ab523750e9e0d9d2cec83af5dd1d1eddfc7
4
+ data.tar.gz: 7f7b5d931178085ec664efb9aae031d3daceb3fd
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YWNiMWQ0OGM5OTkwMTYxOWRlYTE1Yjg1Yzk4NWVkOWQyMGNiN2NiNDM3Yzlj
10
- OTI2YjhhNmIyZTZhMDU3NTc2ZDMyYTQ1NjRjYzY1YTU0YWYwYzMwM2VjMTQy
11
- MTBhZmRkMmQyYTM2YWMxNGMzMTE2ODkwMDQyNmE4NmIwOTkwMGY=
12
- data.tar.gz: !binary |-
13
- NzA1MzcyMDNhOGE1YmJmNzQxY2NlZDZkNDIxODQwYzFkMDI2OTMxZGIxNTRi
14
- MjQyYzhjNGNlM2I0OGU3MDViYzljYWQ5ZTE5OWE3Y2VmYTcxMWU5YmU0ZGMz
15
- ZTkyMjQ4ZWVjOTM4NWVmZWQ1NTMxZGY3NDFkM2FjNWEwOWQ5MmQ=
6
+ metadata.gz: fc24f05ddb0d02a82ca44d8e9fc0a4d79adcf37514e38c1e342f28eefd77a7973b41aa361240b7d915f65ec6e9cebada00e011f42314a1eb7b23581ecb5ccb33
7
+ data.tar.gz: dc9da4587d03feb943adc6e201fb412a0d416f84fee2651dc91ec93d01ea91ddec1f9922c432d7d1be88b7676433a46d4e71778285363014a8fa771a2a7c69a6
@@ -7,7 +7,7 @@ module Addresses
7
7
  def index
8
8
  @state = State.find(params[:state_id])
9
9
 
10
- @cities = @state.cities
10
+ @cities = @state.cities.order("name asc")
11
11
 
12
12
  respond_with @cities
13
13
  end
@@ -0,0 +1,15 @@
1
+ require_dependency "addresses/application_controller"
2
+
3
+ module Addresses
4
+ class NeighborhoodsController < ApplicationController
5
+ respond_to :json
6
+
7
+ def index
8
+ @city = City.find(params[:city_id])
9
+
10
+ @neighborhoods = @city.neighborhoods.order("name asc")
11
+
12
+ respond_with @neighborhoods
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ <h1>Neighborhoods#index</h1>
2
+ <p>Find me in app/views/addresses/neighborhoods/index.html.erb</p>
@@ -1,5 +1,8 @@
1
1
  Addresses::Engine.routes.draw do
2
+
2
3
  resources :cities
3
4
 
5
+ resources :neighborhoods
6
+
4
7
  root to: "cities#index"
5
8
  end
@@ -1,3 +1,3 @@
1
1
  module Addresses
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -6,17 +6,18 @@ module Addresses
6
6
 
7
7
  before do
8
8
  @state = FactoryGirl.create(:addresses_state)
9
+
9
10
  @city = FactoryGirl.create(:addresses_city, state: @state)
10
11
  end
11
12
 
12
13
  describe "GET 'index'" do
13
14
  it "returns http success" do
14
- get 'index', { state_id: @state.id }
15
+ get 'index', { state_id: @state.id, format: :json }
15
16
  response.should be_success
16
17
  end
17
18
 
18
19
  it "assings correct variables" do
19
- get 'index', { state_id: @state.id }
20
+ get 'index', { state_id: @state.id, format: :json }
20
21
  assigns(:cities).should eq([@city])
21
22
  end
22
23
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ module Addresses
4
+ describe NeighborhoodsController do
5
+ routes { Addresses::Engine.routes }
6
+
7
+ before do
8
+ @state = FactoryGirl.create(:addresses_state)
9
+ @city = FactoryGirl.create(:addresses_city, state: @state)
10
+ @neighborhood = FactoryGirl.create(:addresses_neighborhood, city: @city)
11
+ end
12
+
13
+ describe "GET 'index'" do
14
+ it "returns http success" do
15
+ get 'index', { city_id: @state.id, format: :json }
16
+
17
+ response.should be_success
18
+ end
19
+
20
+ it "assings correct variables" do
21
+ get 'index', { city_id: @state.id, format: :json }
22
+ assigns(:neighborhoods).should eq([@neighborhood])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -286,3 +286,268 @@ Processing by Addresses::CitiesController#index as JSON
286
286
  Addresses::City Load (0.2ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."state_id" = ? [["state_id", 1]]
287
287
  Completed 200 OK in 52ms (Views: 2.0ms | ActiveRecord: 0.4ms)
288
288
   (0.5ms) rollback transaction
289
+  (0.4ms) begin transaction
290
+  (0.1ms) rollback transaction
291
+  (0.1ms) begin transaction
292
+  (0.0ms) rollback transaction
293
+  (0.1ms) begin transaction
294
+  (0.0ms) rollback transaction
295
+  (0.0ms) begin transaction
296
+  (0.0ms) rollback transaction
297
+  (0.0ms) begin transaction
298
+  (0.0ms) rollback transaction
299
+  (0.1ms) begin transaction
300
+  (0.1ms) rollback transaction
301
+  (0.4ms) begin transaction
302
+  (0.1ms) rollback transaction
303
+  (0.1ms) begin transaction
304
+  (0.1ms) rollback transaction
305
+  (0.1ms) begin transaction
306
+  (0.1ms) rollback transaction
307
+  (0.1ms) begin transaction
308
+  (0.1ms) rollback transaction
309
+  (0.1ms) begin transaction
310
+  (0.1ms) rollback transaction
311
+  (0.1ms) begin transaction
312
+  (0.1ms) rollback transaction
313
+  (0.3ms) begin transaction
314
+  (0.1ms) rollback transaction
315
+  (0.1ms) begin transaction
316
+  (0.0ms) rollback transaction
317
+  (0.1ms) begin transaction
318
+  (0.0ms) rollback transaction
319
+  (0.0ms) begin transaction
320
+  (0.0ms) rollback transaction
321
+  (0.1ms) begin transaction
322
+  (0.0ms) rollback transaction
323
+  (0.1ms) begin transaction
324
+  (0.1ms) rollback transaction
325
+  (0.3ms) begin transaction
326
+  (0.0ms) rollback transaction
327
+  (0.1ms) begin transaction
328
+  (0.1ms) rollback transaction
329
+  (0.3ms) begin transaction
330
+  (0.1ms) SAVEPOINT active_record_1
331
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:54:27.241742"], ["name", "MyString"], ["updated_at", "2014-05-23 15:54:27.241742"]]
332
+  (0.0ms) RELEASE SAVEPOINT active_record_1
333
+  (0.0ms) SAVEPOINT active_record_1
334
+ SQL (1.1ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:54:27.252202"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:54:27.252202"]]
335
+  (0.1ms) RELEASE SAVEPOINT active_record_1
336
+ Processing by Addresses::CitiesController#index as HTML
337
+ Parameters: {"state_id"=>"1"}
338
+ Addresses::State Load (0.1ms) SELECT "addresses_states".* FROM "addresses_states" WHERE "addresses_states"."id" = ? LIMIT 1 [["id", 1]]
339
+ Completed 406 Not Acceptable in 32ms
340
+  (6.6ms) rollback transaction
341
+  (0.1ms) begin transaction
342
+  (0.1ms) SAVEPOINT active_record_1
343
+ SQL (0.3ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:54:27.300013"], ["name", "MyString"], ["updated_at", "2014-05-23 15:54:27.300013"]]
344
+  (0.1ms) RELEASE SAVEPOINT active_record_1
345
+  (0.0ms) SAVEPOINT active_record_1
346
+ SQL (0.3ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:54:27.302239"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:54:27.302239"]]
347
+  (0.0ms) RELEASE SAVEPOINT active_record_1
348
+ Processing by Addresses::CitiesController#index as HTML
349
+ Parameters: {"state_id"=>"1"}
350
+ Addresses::State Load (0.0ms) SELECT "addresses_states".* FROM "addresses_states" WHERE "addresses_states"."id" = ? LIMIT 1 [["id", 1]]
351
+ Completed 406 Not Acceptable in 1ms
352
+  (0.5ms) rollback transaction
353
+  (0.4ms) begin transaction
354
+  (0.1ms) SAVEPOINT active_record_1
355
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:54:44.118558"], ["name", "MyString"], ["updated_at", "2014-05-23 15:54:44.118558"]]
356
+  (0.0ms) RELEASE SAVEPOINT active_record_1
357
+  (0.1ms) SAVEPOINT active_record_1
358
+ SQL (1.0ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:54:44.128684"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:54:44.128684"]]
359
+  (0.1ms) RELEASE SAVEPOINT active_record_1
360
+ Processing by Addresses::CitiesController#index as JSON
361
+ Parameters: {"state_id"=>1}
362
+ Addresses::State Load (0.1ms) SELECT "addresses_states".* FROM "addresses_states" WHERE "addresses_states"."id" = ? LIMIT 1 [["id", 1]]
363
+ Addresses::City Load (0.3ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."state_id" = ? ORDER BY name as [["state_id", 1]]
364
+ SQLite3::SQLException: near "as": syntax error: SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."state_id" = ? ORDER BY name as
365
+ Completed 500 Internal Server Error in 18ms
366
+  (6.7ms) rollback transaction
367
+  (0.3ms) begin transaction
368
+  (0.1ms) SAVEPOINT active_record_1
369
+ SQL (0.7ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:55:13.336225"], ["name", "MyString"], ["updated_at", "2014-05-23 15:55:13.336225"]]
370
+  (0.0ms) RELEASE SAVEPOINT active_record_1
371
+  (0.1ms) SAVEPOINT active_record_1
372
+ SQL (1.1ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:55:13.346847"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:55:13.346847"]]
373
+  (0.1ms) RELEASE SAVEPOINT active_record_1
374
+ Processing by Addresses::CitiesController#index as JSON
375
+ Parameters: {"state_id"=>1}
376
+ Addresses::State Load (0.2ms) SELECT "addresses_states".* FROM "addresses_states" WHERE "addresses_states"."id" = ? LIMIT 1 [["id", 1]]
377
+ Addresses::City Load (0.2ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."state_id" = ? ORDER BY name asc [["state_id", 1]]
378
+ Completed 200 OK in 18ms (Views: 1.4ms | ActiveRecord: 0.3ms)
379
+  (6.7ms) rollback transaction
380
+  (0.1ms) begin transaction
381
+  (0.1ms) SAVEPOINT active_record_1
382
+ SQL (0.3ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:55:13.380947"], ["name", "MyString"], ["updated_at", "2014-05-23 15:55:13.380947"]]
383
+  (0.1ms) RELEASE SAVEPOINT active_record_1
384
+  (0.0ms) SAVEPOINT active_record_1
385
+ SQL (0.3ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:55:13.383282"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:55:13.383282"]]
386
+  (0.0ms) RELEASE SAVEPOINT active_record_1
387
+ Processing by Addresses::CitiesController#index as JSON
388
+ Parameters: {"state_id"=>1}
389
+ Addresses::State Load (0.1ms) SELECT "addresses_states".* FROM "addresses_states" WHERE "addresses_states"."id" = ? LIMIT 1 [["id", 1]]
390
+ Addresses::City Load (0.1ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."state_id" = ? ORDER BY name asc [["state_id", 1]]
391
+ Completed 200 OK in 2ms (Views: 0.7ms | ActiveRecord: 0.1ms)
392
+  (0.5ms) rollback transaction
393
+  (0.4ms) begin transaction
394
+  (0.1ms) SAVEPOINT active_record_1
395
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:55:19.506267"], ["name", "MyString"], ["updated_at", "2014-05-23 15:55:19.506267"]]
396
+  (0.0ms) RELEASE SAVEPOINT active_record_1
397
+  (0.1ms) SAVEPOINT active_record_1
398
+ SQL (1.2ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:55:19.516265"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:55:19.516265"]]
399
+  (0.1ms) RELEASE SAVEPOINT active_record_1
400
+  (6.9ms) rollback transaction
401
+  (0.1ms) begin transaction
402
+  (0.2ms) SAVEPOINT active_record_1
403
+ SQL (0.3ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:55:19.529701"], ["name", "MyString"], ["updated_at", "2014-05-23 15:55:19.529701"]]
404
+  (0.1ms) RELEASE SAVEPOINT active_record_1
405
+  (0.0ms) SAVEPOINT active_record_1
406
+ SQL (0.3ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:55:19.531796"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:55:19.531796"]]
407
+  (0.0ms) RELEASE SAVEPOINT active_record_1
408
+  (0.5ms) rollback transaction
409
+  (0.4ms) begin transaction
410
+  (0.1ms) SAVEPOINT active_record_1
411
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:55:31.715025"], ["name", "MyString"], ["updated_at", "2014-05-23 15:55:31.715025"]]
412
+  (0.1ms) RELEASE SAVEPOINT active_record_1
413
+  (0.1ms) SAVEPOINT active_record_1
414
+ SQL (1.1ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:55:31.725400"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:55:31.725400"]]
415
+  (0.0ms) RELEASE SAVEPOINT active_record_1
416
+  (6.7ms) rollback transaction
417
+  (0.1ms) begin transaction
418
+  (0.1ms) SAVEPOINT active_record_1
419
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:55:31.739746"], ["name", "MyString"], ["updated_at", "2014-05-23 15:55:31.739746"]]
420
+  (0.1ms) RELEASE SAVEPOINT active_record_1
421
+  (0.1ms) SAVEPOINT active_record_1
422
+ SQL (0.4ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:55:31.742664"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:55:31.742664"]]
423
+  (0.1ms) RELEASE SAVEPOINT active_record_1
424
+  (0.7ms) rollback transaction
425
+  (0.3ms) begin transaction
426
+  (0.1ms) SAVEPOINT active_record_1
427
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:56:29.743829"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:29.743829"]]
428
+  (0.0ms) RELEASE SAVEPOINT active_record_1
429
+  (0.0ms) SAVEPOINT active_record_1
430
+ SQL (1.1ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:56:29.754197"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:56:29.754197"]]
431
+  (0.1ms) RELEASE SAVEPOINT active_record_1
432
+  (0.1ms) SAVEPOINT active_record_1
433
+ SQL (0.2ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:56:29.762166"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:29.762166"]]
434
+  (0.0ms) RELEASE SAVEPOINT active_record_1
435
+ Processing by Addresses::CitiesController#index as HTML
436
+ Parameters: {"city_id"=>"1"}
437
+ Completed 404 Not Found in 0ms
438
+  (6.9ms) rollback transaction
439
+  (0.1ms) begin transaction
440
+  (0.1ms) SAVEPOINT active_record_1
441
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:56:29.776548"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:29.776548"]]
442
+  (0.1ms) RELEASE SAVEPOINT active_record_1
443
+  (0.1ms) SAVEPOINT active_record_1
444
+ SQL (0.4ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:56:29.779307"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:56:29.779307"]]
445
+  (0.1ms) RELEASE SAVEPOINT active_record_1
446
+  (0.0ms) SAVEPOINT active_record_1
447
+ SQL (0.2ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:56:29.806744"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:29.806744"]]
448
+  (0.1ms) RELEASE SAVEPOINT active_record_1
449
+ Processing by Addresses::CitiesController#index as HTML
450
+ Parameters: {"city_id"=>"1"}
451
+ Completed 404 Not Found in 0ms
452
+  (0.5ms) rollback transaction
453
+  (0.3ms) begin transaction
454
+  (0.1ms) SAVEPOINT active_record_1
455
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:56:56.745299"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:56.745299"]]
456
+  (0.0ms) RELEASE SAVEPOINT active_record_1
457
+  (0.1ms) SAVEPOINT active_record_1
458
+ SQL (1.1ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:56:56.757207"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:56:56.757207"]]
459
+  (0.1ms) RELEASE SAVEPOINT active_record_1
460
+  (0.0ms) SAVEPOINT active_record_1
461
+ SQL (0.2ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:56:56.764669"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:56.764669"]]
462
+  (0.0ms) RELEASE SAVEPOINT active_record_1
463
+  (6.6ms) rollback transaction
464
+  (0.1ms) begin transaction
465
+  (0.1ms) SAVEPOINT active_record_1
466
+ SQL (0.3ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:56:56.776813"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:56.776813"]]
467
+  (0.1ms) RELEASE SAVEPOINT active_record_1
468
+  (0.0ms) SAVEPOINT active_record_1
469
+ SQL (0.3ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:56:56.778844"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:56:56.778844"]]
470
+  (0.0ms) RELEASE SAVEPOINT active_record_1
471
+  (0.0ms) SAVEPOINT active_record_1
472
+ SQL (0.1ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:56:56.780420"], ["name", "MyString"], ["updated_at", "2014-05-23 15:56:56.780420"]]
473
+  (0.0ms) RELEASE SAVEPOINT active_record_1
474
+  (0.5ms) rollback transaction
475
+  (0.4ms) begin transaction
476
+  (0.1ms) SAVEPOINT active_record_1
477
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:57:19.202505"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:19.202505"]]
478
+  (0.0ms) RELEASE SAVEPOINT active_record_1
479
+  (0.1ms) SAVEPOINT active_record_1
480
+ SQL (0.9ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:57:19.213042"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:57:19.213042"]]
481
+  (0.1ms) RELEASE SAVEPOINT active_record_1
482
+  (0.1ms) SAVEPOINT active_record_1
483
+ SQL (0.2ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:57:19.221021"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:19.221021"]]
484
+  (0.0ms) RELEASE SAVEPOINT active_record_1
485
+ Processing by Addresses::NeighborhoodsController#index as HTML
486
+ Parameters: {"city_id"=>"1"}
487
+ Addresses::City Load (0.1ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."id" = ? LIMIT 1 [["id", 1]]
488
+ Completed 406 Not Acceptable in 11ms
489
+  (6.6ms) rollback transaction
490
+  (0.1ms) begin transaction
491
+  (0.1ms) SAVEPOINT active_record_1
492
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:57:19.245790"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:19.245790"]]
493
+  (0.1ms) RELEASE SAVEPOINT active_record_1
494
+  (0.0ms) SAVEPOINT active_record_1
495
+ SQL (0.3ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:57:19.248087"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:57:19.248087"]]
496
+  (0.0ms) RELEASE SAVEPOINT active_record_1
497
+  (0.0ms) SAVEPOINT active_record_1
498
+ SQL (0.1ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:57:19.249743"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:19.249743"]]
499
+  (0.0ms) RELEASE SAVEPOINT active_record_1
500
+ Processing by Addresses::NeighborhoodsController#index as HTML
501
+ Parameters: {"city_id"=>"1"}
502
+ Addresses::City Load (0.0ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."id" = ? LIMIT 1 [["id", 1]]
503
+ Completed 406 Not Acceptable in 1ms
504
+  (0.6ms) rollback transaction
505
+  (0.3ms) begin transaction
506
+  (0.1ms) SAVEPOINT active_record_1
507
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:57:38.635619"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:38.635619"]]
508
+  (0.0ms) RELEASE SAVEPOINT active_record_1
509
+  (0.1ms) SAVEPOINT active_record_1
510
+ SQL (1.0ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:57:38.647821"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:57:38.647821"]]
511
+  (0.1ms) RELEASE SAVEPOINT active_record_1
512
+  (0.1ms) SAVEPOINT active_record_1
513
+ SQL (0.2ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:57:38.656173"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:38.656173"]]
514
+  (0.0ms) RELEASE SAVEPOINT active_record_1
515
+ Processing by Addresses::NeighborhoodsController#index as JSON
516
+ Parameters: {"city_id"=>1}
517
+ Addresses::City Load (0.1ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."id" = ? LIMIT 1 [["id", 1]]
518
+ Addresses::Neighborhood Load (0.2ms) SELECT "addresses_neighborhoods".* FROM "addresses_neighborhoods" WHERE "addresses_neighborhoods"."city_id" = ? ORDER BY name asc [["city_id", 1]]
519
+ Completed 200 OK in 17ms (Views: 1.0ms | ActiveRecord: 0.3ms)
520
+  (6.6ms) rollback transaction
521
+  (0.1ms) begin transaction
522
+  (0.1ms) SAVEPOINT active_record_1
523
+ SQL (0.3ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:57:38.712760"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:38.712760"]]
524
+  (0.1ms) RELEASE SAVEPOINT active_record_1
525
+  (0.0ms) SAVEPOINT active_record_1
526
+ SQL (0.3ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:57:38.715131"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:57:38.715131"]]
527
+  (0.0ms) RELEASE SAVEPOINT active_record_1
528
+  (0.0ms) SAVEPOINT active_record_1
529
+ SQL (0.1ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:57:38.716913"], ["name", "MyString"], ["updated_at", "2014-05-23 15:57:38.716913"]]
530
+  (0.0ms) RELEASE SAVEPOINT active_record_1
531
+ Processing by Addresses::NeighborhoodsController#index as JSON
532
+ Parameters: {"city_id"=>1}
533
+ Addresses::City Load (0.0ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."id" = ? LIMIT 1 [["id", 1]]
534
+ Addresses::Neighborhood Load (0.1ms) SELECT "addresses_neighborhoods".* FROM "addresses_neighborhoods" WHERE "addresses_neighborhoods"."city_id" = ? ORDER BY name asc [["city_id", 1]]
535
+ Completed 200 OK in 3ms (Views: 1.2ms | ActiveRecord: 0.2ms)
536
+  (0.7ms) rollback transaction
537
+  (0.3ms) begin transaction
538
+  (0.1ms) SAVEPOINT active_record_1
539
+ SQL (0.4ms) INSERT INTO "addresses_states" ("acronym", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["acronym", "MyString"], ["created_at", "2014-05-23 15:58:37.187596"], ["name", "MyString"], ["updated_at", "2014-05-23 15:58:37.187596"]]
540
+  (0.0ms) RELEASE SAVEPOINT active_record_1
541
+  (0.0ms) SAVEPOINT active_record_1
542
+ SQL (1.4ms) INSERT INTO "addresses_cities" ("created_at", "name", "state_id", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-05-23 15:58:37.197225"], ["name", "MyString"], ["state_id", 1], ["updated_at", "2014-05-23 15:58:37.197225"]]
543
+  (0.1ms) RELEASE SAVEPOINT active_record_1
544
+  (0.1ms) SAVEPOINT active_record_1
545
+ SQL (0.2ms) INSERT INTO "addresses_neighborhoods" ("city_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?) [["city_id", 1], ["created_at", "2014-05-23 15:58:37.205419"], ["name", "MyString"], ["updated_at", "2014-05-23 15:58:37.205419"]]
546
+  (0.0ms) RELEASE SAVEPOINT active_record_1
547
+ Started GET "/addresses/neighborhoods?format=json&city_id=1" for 127.0.0.1 at 2014-05-23 12:58:37 -0300
548
+ Processing by Addresses::NeighborhoodsController#index as JSON
549
+ Parameters: {"city_id"=>"1"}
550
+ Addresses::City Load (0.2ms) SELECT "addresses_cities".* FROM "addresses_cities" WHERE "addresses_cities"."id" = ? LIMIT 1 [["id", 1]]
551
+ Addresses::Neighborhood Load (0.1ms) SELECT "addresses_neighborhoods".* FROM "addresses_neighborhoods" WHERE "addresses_neighborhoods"."city_id" = ? ORDER BY name asc [["city_id", 1]]
552
+ Completed 200 OK in 19ms (Views: 1.0ms | ActiveRecord: 0.3ms)
553
+  (0.7ms) rollback transaction
@@ -1,7 +1,7 @@
1
1
  # Read about factories at https://github.com/thoughtbot/factory_girl
2
2
 
3
3
  FactoryGirl.define do
4
- factory :addresses_neighborhood, :class => 'Neighborhood' do
4
+ factory :addresses_neighborhood, :class => Addresses::Neighborhood do
5
5
  city nil
6
6
  name "MyString"
7
7
  end
@@ -8,7 +8,7 @@ describe Addresses::CitiesController do
8
8
  @city = FactoryGirl.create(:addresses_city, state: @state)
9
9
  end
10
10
 
11
- describe "GET /api/v1/interviews" do
11
+ describe "GET /cities" do
12
12
  it "should return an interview" do
13
13
  get addresses.cities_path(state_id: @state.id), format: "json"
14
14
  json = JSON.parse(response.body)
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Addresses::NeighborhoodsController do
4
+ #routes { Addresses::Engine.routes }
5
+
6
+ before (:each) do
7
+ @state = FactoryGirl.create(:addresses_state)
8
+ @city = FactoryGirl.create(:addresses_city, state: @state)
9
+ @neighborhood = FactoryGirl.create(:addresses_neighborhood, city: @city)
10
+ end
11
+
12
+ describe "GET /neighborhoods" do
13
+ it "should return an interview" do
14
+ get addresses.neighborhoods_path(city_id: @city.id), format: "json"
15
+
16
+ json = JSON.parse(response.body)
17
+
18
+ json[0]["name"].should == @neighborhood.name
19
+ end
20
+ end
21
+ end
@@ -7,6 +7,9 @@ require 'factory_girl_rails'
7
7
 
8
8
  Rails.backtrace_cleaner.remove_silencers!
9
9
 
10
+ FactoryGirl.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
11
+ FactoryGirl.find_definitions
12
+
10
13
  # Load support files
11
14
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
15
  RSpec.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilbert Ribeiro
@@ -9,22 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-25 00:00:00.000000000 Z
12
+ date: 2014-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: sqlite3
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 1.3.9
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 1.3.9
28
42
  description: Create Country, State, City, Neighborhood and a polymorphic model called
29
43
  Address that can be related as addessable.
30
44
  email:
@@ -41,6 +55,7 @@ files:
41
55
  - app/assets/stylesheets/addresses/application.css
42
56
  - app/controllers/addresses/application_controller.rb
43
57
  - app/controllers/addresses/cities_controller.rb
58
+ - app/controllers/addresses/neighborhoods_controller.rb
44
59
  - app/helpers/addresses/application_helper.rb
45
60
  - app/models/addresses/address.rb
46
61
  - app/models/addresses/city.rb
@@ -48,6 +63,7 @@ files:
48
63
  - app/models/addresses/neighborhood.rb
49
64
  - app/models/addresses/state.rb
50
65
  - app/views/addresses/cities/index.html.erb
66
+ - app/views/addresses/neighborhoods/index.html.erb
51
67
  - app/views/layouts/addresses/application.html.erb
52
68
  - config/routes.rb
53
69
  - db/migrate/20140327141509_create_addresses_countries.rb
@@ -64,6 +80,7 @@ files:
64
80
  - lib/tasks/populate_neighborhoods.rake
65
81
  - lib/tasks/populate_states.rake
66
82
  - spec/controllers/addresses/cities_controller_spec.rb
83
+ - spec/controllers/addresses/neighborhoods_controller_spec.rb
67
84
  - spec/dummy/Gemfile
68
85
  - spec/dummy/Gemfile.lock
69
86
  - spec/dummy/README.rdoc
@@ -119,6 +136,7 @@ files:
119
136
  - spec/models/addresses/neighborhood_spec.rb
120
137
  - spec/models/addresses/state_spec.rb
121
138
  - spec/requests/cities_spec.rb
139
+ - spec/requests/neighborhoods_spec.rb
122
140
  - spec/routing/cities_routing_spec.rb
123
141
  - spec/spec_helper.rb
124
142
  homepage: http://www.github.com/wilbert/addresses
@@ -131,12 +149,12 @@ require_paths:
131
149
  - lib
132
150
  required_ruby_version: !ruby/object:Gem::Requirement
133
151
  requirements:
134
- - - ! '>='
152
+ - - ">="
135
153
  - !ruby/object:Gem::Version
136
154
  version: '0'
137
155
  required_rubygems_version: !ruby/object:Gem::Requirement
138
156
  requirements:
139
- - - ! '>='
157
+ - - ">="
140
158
  - !ruby/object:Gem::Version
141
159
  version: '0'
142
160
  requirements: []
@@ -147,6 +165,7 @@ specification_version: 4
147
165
  summary: This engine allows create default addresses models for any usage.
148
166
  test_files:
149
167
  - spec/controllers/addresses/cities_controller_spec.rb
168
+ - spec/controllers/addresses/neighborhoods_controller_spec.rb
150
169
  - spec/dummy/app/assets/javascripts/application.js
151
170
  - spec/dummy/app/assets/stylesheets/application.css
152
171
  - spec/dummy/app/controllers/application_controller.rb
@@ -202,5 +221,6 @@ test_files:
202
221
  - spec/models/addresses/neighborhood_spec.rb
203
222
  - spec/models/addresses/state_spec.rb
204
223
  - spec/requests/cities_spec.rb
224
+ - spec/requests/neighborhoods_spec.rb
205
225
  - spec/routing/cities_routing_spec.rb
206
226
  - spec/spec_helper.rb