nubis_rails_boilerplate 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/bin/new_real_estate_app +2 -1
  2. data/skeletons/real_estate_app/Capfile +6 -0
  3. data/skeletons/real_estate_app/Gemfile +61 -0
  4. data/skeletons/real_estate_app/Gemfile.lock +315 -0
  5. data/skeletons/real_estate_app/README.rdoc +261 -0
  6. data/skeletons/real_estate_app/Rakefile +7 -0
  7. data/skeletons/real_estate_app/app/admin/admin_user.rb +20 -0
  8. data/skeletons/real_estate_app/app/admin/dashboard.rb +33 -0
  9. data/skeletons/real_estate_app/app/admin/neighborhood.rb +22 -0
  10. data/skeletons/real_estate_app/app/admin/property.rb +49 -0
  11. data/skeletons/real_estate_app/app/assets/images/rails.png +0 -0
  12. data/skeletons/real_estate_app/app/assets/javascripts/active_admin.js +1 -0
  13. data/skeletons/real_estate_app/app/assets/javascripts/application.js +15 -0
  14. data/skeletons/real_estate_app/app/assets/stylesheets/active_admin.css.scss +4 -0
  15. data/skeletons/real_estate_app/app/assets/stylesheets/application.css.scss +4 -0
  16. data/skeletons/real_estate_app/app/assets/stylesheets/main.css.scss +3 -0
  17. data/skeletons/real_estate_app/app/controllers/application_controller.rb +3 -0
  18. data/skeletons/real_estate_app/app/controllers/neighborhoods_controller.rb +9 -0
  19. data/skeletons/real_estate_app/app/controllers/pages_controller.rb +16 -0
  20. data/skeletons/real_estate_app/app/controllers/properties_controller.rb +9 -0
  21. data/skeletons/real_estate_app/app/helpers/application_helper.rb +2 -0
  22. data/skeletons/real_estate_app/app/models/admin_user.rb +11 -0
  23. data/skeletons/real_estate_app/app/models/image.rb +7 -0
  24. data/skeletons/real_estate_app/app/models/neighborhood.rb +6 -0
  25. data/skeletons/real_estate_app/app/models/property.rb +7 -0
  26. data/skeletons/real_estate_app/app/models/settings.rb +3 -0
  27. data/skeletons/real_estate_app/app/views/layouts/_navigation.html.haml +9 -0
  28. data/skeletons/real_estate_app/app/views/layouts/application.html.haml +38 -0
  29. data/skeletons/real_estate_app/app/views/neighborhoods/index.html.haml +12 -0
  30. data/skeletons/real_estate_app/app/views/neighborhoods/show.html.haml +12 -0
  31. data/skeletons/real_estate_app/app/views/pages/about_us.html.haml +5 -0
  32. data/skeletons/real_estate_app/app/views/pages/contact_us.html.haml +5 -0
  33. data/skeletons/real_estate_app/app/views/pages/home.html.haml +5 -0
  34. data/skeletons/real_estate_app/app/views/pages/privacy_policy.html.haml +5 -0
  35. data/skeletons/real_estate_app/app/views/pages/terms_of_service.html.haml +5 -0
  36. data/skeletons/real_estate_app/app/views/properties/index.html.haml +12 -0
  37. data/skeletons/real_estate_app/app/views/properties/show.html.haml +4 -0
  38. data/skeletons/real_estate_app/config/application.rb +62 -0
  39. data/skeletons/real_estate_app/config/boot.rb +6 -0
  40. data/skeletons/real_estate_app/config/database.yml +42 -0
  41. data/skeletons/real_estate_app/config/deploy.rb +3 -0
  42. data/skeletons/real_estate_app/config/deploy.yml +26 -0
  43. data/skeletons/real_estate_app/config/environment.rb +5 -0
  44. data/skeletons/real_estate_app/config/environments/development.rb +39 -0
  45. data/skeletons/real_estate_app/config/environments/production.rb +92 -0
  46. data/skeletons/real_estate_app/config/environments/test.rb +37 -0
  47. data/skeletons/real_estate_app/config/initializers/active_admin.rb +152 -0
  48. data/skeletons/real_estate_app/config/initializers/backtrace_silencers.rb +7 -0
  49. data/skeletons/real_estate_app/config/initializers/devise.rb +240 -0
  50. data/skeletons/real_estate_app/config/initializers/inflections.rb +15 -0
  51. data/skeletons/real_estate_app/config/initializers/mime_types.rb +5 -0
  52. data/skeletons/real_estate_app/config/initializers/secret_token.rb +7 -0
  53. data/skeletons/real_estate_app/config/initializers/session_store.rb +8 -0
  54. data/skeletons/real_estate_app/config/initializers/wrap_parameters.rb +14 -0
  55. data/skeletons/real_estate_app/config/locales/devise.en.yml +59 -0
  56. data/skeletons/real_estate_app/config/locales/en.yml +5 -0
  57. data/skeletons/real_estate_app/config/routes.rb +71 -0
  58. data/skeletons/real_estate_app/config.ru +4 -0
  59. data/skeletons/real_estate_app/db/migrate/20130209155748_devise_create_admin_users.rb +52 -0
  60. data/skeletons/real_estate_app/db/migrate/20130209155756_create_admin_notes.rb +17 -0
  61. data/skeletons/real_estate_app/db/migrate/20130209155757_move_admin_notes_to_comments.rb +26 -0
  62. data/skeletons/real_estate_app/db/migrate/20130209160552_initial_tables.rb +42 -0
  63. data/skeletons/real_estate_app/db/schema.rb +103 -0
  64. data/skeletons/real_estate_app/db/seeds.rb +7 -0
  65. data/skeletons/real_estate_app/doc/README_FOR_APP +2 -0
  66. data/skeletons/real_estate_app/public/404.html +26 -0
  67. data/skeletons/real_estate_app/public/422.html +26 -0
  68. data/skeletons/real_estate_app/public/500.html +25 -0
  69. data/skeletons/real_estate_app/public/favicon.ico +0 -0
  70. data/skeletons/real_estate_app/public/robots.txt +5 -0
  71. data/skeletons/real_estate_app/script/rails +6 -0
  72. data/skeletons/real_estate_app/spec/controllers/admin/admin_users_controller_spec.rb +11 -0
  73. data/skeletons/real_estate_app/spec/controllers/admin/neighborhoods_controller_spec.rb +12 -0
  74. data/skeletons/real_estate_app/spec/controllers/admin/properties_controller_spec.rb +12 -0
  75. data/skeletons/real_estate_app/spec/controllers/neighborhoods_controller_spec.rb +19 -0
  76. data/skeletons/real_estate_app/spec/controllers/pages_controller_spec.rb +31 -0
  77. data/skeletons/real_estate_app/spec/controllers/properties_controller_spec.rb +19 -0
  78. data/skeletons/real_estate_app/spec/factories/admin_users.rb +8 -0
  79. data/skeletons/real_estate_app/spec/factories/neigborhoods.rb +16 -0
  80. data/skeletons/real_estate_app/spec/factories/properties.rb +28 -0
  81. data/skeletons/real_estate_app/spec/fixtures/image.jpg +0 -0
  82. data/skeletons/real_estate_app/spec/models/admin_user_spec.rb +5 -0
  83. data/skeletons/real_estate_app/spec/models/image_spec.rb +10 -0
  84. data/skeletons/real_estate_app/spec/models/property_spec.rb +7 -0
  85. data/skeletons/real_estate_app/spec/spec_helper.rb +22 -0
  86. data/skeletons/real_estate_app/test/performance/browsing_test.rb +12 -0
  87. data/skeletons/real_estate_app/test/test_helper.rb +13 -0
  88. metadata +95 -9
@@ -0,0 +1,52 @@
1
+ class DeviseCreateAdminUsers < ActiveRecord::Migration
2
+ def migrate(direction)
3
+ super
4
+ # Create a default user
5
+ AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up
6
+ end
7
+
8
+ def change
9
+ create_table(:admin_users) do |t|
10
+ ## Database authenticatable
11
+ t.string :email, :null => false, :default => ""
12
+ t.string :encrypted_password, :null => false, :default => ""
13
+
14
+ ## Recoverable
15
+ t.string :reset_password_token
16
+ t.datetime :reset_password_sent_at
17
+
18
+ ## Rememberable
19
+ t.datetime :remember_created_at
20
+
21
+ ## Trackable
22
+ t.integer :sign_in_count, :default => 0
23
+ t.datetime :current_sign_in_at
24
+ t.datetime :last_sign_in_at
25
+ t.string :current_sign_in_ip
26
+ t.string :last_sign_in_ip
27
+
28
+ ## Confirmable
29
+ # t.string :confirmation_token
30
+ # t.datetime :confirmed_at
31
+ # t.datetime :confirmation_sent_at
32
+ # t.string :unconfirmed_email # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
36
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
37
+ # t.datetime :locked_at
38
+
39
+ ## Token authenticatable
40
+ # t.string :authentication_token
41
+
42
+
43
+ t.timestamps
44
+ end
45
+
46
+ add_index :admin_users, :email, :unique => true
47
+ add_index :admin_users, :reset_password_token, :unique => true
48
+ # add_index :admin_users, :confirmation_token, :unique => true
49
+ # add_index :admin_users, :unlock_token, :unique => true
50
+ # add_index :admin_users, :authentication_token, :unique => true
51
+ end
52
+ end
@@ -0,0 +1,17 @@
1
+ class CreateAdminNotes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :admin_notes do |t|
4
+ t.string :resource_id, :null => false
5
+ t.string :resource_type, :null => false
6
+ t.references :admin_user, :polymorphic => true
7
+ t.text :body
8
+ t.timestamps
9
+ end
10
+ add_index :admin_notes, [:resource_type, :resource_id]
11
+ add_index :admin_notes, [:admin_user_type, :admin_user_id]
12
+ end
13
+
14
+ def self.down
15
+ drop_table :admin_notes
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ class MoveAdminNotesToComments < ActiveRecord::Migration
2
+ def self.up
3
+ remove_index :admin_notes, [:admin_user_type, :admin_user_id]
4
+ rename_table :admin_notes, :active_admin_comments
5
+ rename_column :active_admin_comments, :admin_user_type, :author_type
6
+ rename_column :active_admin_comments, :admin_user_id, :author_id
7
+ add_column :active_admin_comments, :namespace, :string
8
+ add_index :active_admin_comments, [:namespace]
9
+ add_index :active_admin_comments, [:author_type, :author_id]
10
+
11
+ # Update all the existing comments to the default namespace
12
+ say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace."
13
+ comments_table_name = ActiveRecord::Migrator.proper_table_name("active_admin_comments")
14
+ execute "UPDATE #{comments_table_name} SET namespace='#{ActiveAdmin.application.default_namespace}'"
15
+ end
16
+
17
+ def self.down
18
+ remove_index :active_admin_comments, :column => [:author_type, :author_id]
19
+ remove_index :active_admin_comments, :column => [:namespace]
20
+ remove_column :active_admin_comments, :namespace
21
+ rename_column :active_admin_comments, :author_id, :admin_user_id
22
+ rename_column :active_admin_comments, :author_type, :admin_user_type
23
+ rename_table :active_admin_comments, :admin_notes
24
+ add_index :admin_notes, [:admin_user_type, :admin_user_id]
25
+ end
26
+ end
@@ -0,0 +1,42 @@
1
+ class InitialTables < ActiveRecord::Migration
2
+ create_table :images, force: true do |t|
3
+ t.integer :viewable_id
4
+ t.string :viewable_type, limit: 50
5
+ t.attachment :file
6
+ t.integer :position
7
+ t.timestamps
8
+ end
9
+
10
+ add_index :images, [:viewable_id], name: :index_images_on_viewable_id
11
+ add_index :images, [:viewable_type], name: :index_images_on_viewable_type
12
+
13
+ create_table :properties, force: true do |t|
14
+ t.string :name
15
+ t.string :url_name
16
+ t.text :description
17
+ t.references :neighborhood
18
+ t.float :latitude
19
+ t.float :longitude
20
+ t.string :address
21
+ t.string :public_address
22
+ t.integer :covered_square_meters
23
+ t.integer :uncovered_square_meters
24
+ t.integer :rooms
25
+ t.integer :bathrooms
26
+ t.text :amenities
27
+ t.string :keywords
28
+ t.boolean :for_rent
29
+ t.boolean :for_sale
30
+ t.timestamps
31
+ end
32
+
33
+ add_index :properties, [:neighborhood_id], name: :index_images_on_neighborhood_id
34
+
35
+ create_table :neighborhoods, force: true do |t|
36
+ t.string :name
37
+ t.string :url_name
38
+ t.text :description
39
+ t.text :amenities
40
+ t.timestamps
41
+ end
42
+ end
@@ -0,0 +1,103 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130209160552) do
15
+
16
+ create_table "active_admin_comments", :force => true do |t|
17
+ t.string "resource_id", :null => false
18
+ t.string "resource_type", :null => false
19
+ t.integer "author_id"
20
+ t.string "author_type"
21
+ t.text "body"
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
+ t.string "namespace"
25
+ end
26
+
27
+ add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
28
+ add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
29
+ add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
30
+
31
+ create_table "admin_users", :force => true do |t|
32
+ t.string "email", :default => "", :null => false
33
+ t.string "encrypted_password", :default => "", :null => false
34
+ t.string "reset_password_token"
35
+ t.datetime "reset_password_sent_at"
36
+ t.datetime "remember_created_at"
37
+ t.integer "sign_in_count", :default => 0
38
+ t.datetime "current_sign_in_at"
39
+ t.datetime "last_sign_in_at"
40
+ t.string "current_sign_in_ip"
41
+ t.string "last_sign_in_ip"
42
+ t.datetime "created_at", :null => false
43
+ t.datetime "updated_at", :null => false
44
+ end
45
+
46
+ add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
47
+ add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true
48
+
49
+ create_table "images", :force => true do |t|
50
+ t.integer "viewable_id"
51
+ t.string "viewable_type", :limit => 50
52
+ t.string "file_file_name"
53
+ t.string "file_content_type"
54
+ t.integer "file_file_size"
55
+ t.datetime "file_updated_at"
56
+ t.integer "position"
57
+ t.datetime "created_at", :null => false
58
+ t.datetime "updated_at", :null => false
59
+ end
60
+
61
+ add_index "images", ["viewable_id"], :name => "index_images_on_viewable_id"
62
+ add_index "images", ["viewable_type"], :name => "index_images_on_viewable_type"
63
+
64
+ create_table "neighborhood", :force => true do |t|
65
+ t.string "name"
66
+ t.string "url_name"
67
+ t.text "description"
68
+ t.text "amenities"
69
+ end
70
+
71
+ create_table "neighborhoods", :force => true do |t|
72
+ t.string "name"
73
+ t.string "url_name"
74
+ t.text "description"
75
+ t.text "amenities"
76
+ t.datetime "created_at", :null => false
77
+ t.datetime "updated_at", :null => false
78
+ end
79
+
80
+ create_table "properties", :force => true do |t|
81
+ t.string "name"
82
+ t.string "url_name"
83
+ t.text "description"
84
+ t.integer "neighborhood_id"
85
+ t.float "latitude"
86
+ t.float "longitude"
87
+ t.string "address"
88
+ t.string "public_address"
89
+ t.integer "covered_square_meters"
90
+ t.integer "uncovered_square_meters"
91
+ t.integer "rooms"
92
+ t.integer "bathrooms"
93
+ t.text "amenities"
94
+ t.string "keywords"
95
+ t.boolean "for_rent"
96
+ t.boolean "for_sale"
97
+ t.datetime "created_at", :null => false
98
+ t.datetime "updated_at", :null => false
99
+ end
100
+
101
+ add_index "properties", ["neighborhood_id"], :name => "index_images_on_neighborhood_id"
102
+
103
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Admin::AdminUsersController do
4
+ render_views
5
+
6
+ it "gets the list of available pre_signups" do
7
+ sign_in create(:admin_user)
8
+ get :index
9
+ assigns(:admin_users).should == AdminUser.all
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Admin::NeighborhoodsController do
4
+ render_views
5
+
6
+ it 'gets all neighborhoods' do
7
+ neighborhood = create(:neighborhood)
8
+ sign_in create(:admin_user)
9
+ get :index
10
+ assigns(:neighborhoods).should == [neighborhood]
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Admin::PropertiesController do
4
+ render_views
5
+
6
+ it 'gets all properties' do
7
+ property = create(:property)
8
+ sign_in create(:admin_user)
9
+ get :index
10
+ assigns(:properties).should == [property]
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe NeighborhoodsController do
4
+ render_views
5
+
6
+ it 'shows all neighborhoods on index' do
7
+ neighborhood = create :neighborhood
8
+ get :index
9
+ response.should be_ok
10
+ assigns(:neighborhoods).should == [neighborhood]
11
+ end
12
+
13
+ it 'shows a single neighborhood' do
14
+ neighborhood = create :neighborhood
15
+ get :show, id: neighborhood.id
16
+ response.should be_ok
17
+ assigns(:neighborhood).should == neighborhood
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe PagesController do
4
+ render_views
5
+
6
+ it 'has a home page' do
7
+ get :home
8
+ response.should be_ok
9
+ end
10
+
11
+ it 'has an about us page' do
12
+ get :about_us
13
+ response.should be_ok
14
+ end
15
+
16
+ it 'has a terms of service page' do
17
+ get :terms_of_service
18
+ response.should be_ok
19
+ end
20
+
21
+ it 'has a privacy policy page' do
22
+ get :privacy_policy
23
+ response.should be_ok
24
+ end
25
+
26
+ it 'has a contact us page' do
27
+ get :contact_us
28
+ response.should be_ok
29
+ end
30
+ end
31
+
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe PropertiesController do
4
+ render_views
5
+
6
+ it 'shows all properties on index' do
7
+ property = create :property
8
+ get :index
9
+ response.should be_ok
10
+ assigns(:properties).should == [property]
11
+ end
12
+
13
+ it 'shows a single property' do
14
+ property = create :property
15
+ get :show, id: property.id
16
+ response.should be_ok
17
+ assigns(:property).should == property
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :admin_user do
5
+ email 'admin@example.com'
6
+ password 'password'
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ #encoding: utf-8
2
+ FactoryGirl.define do
3
+ factory :neighborhood do
4
+ name 'House in the hill'
5
+ url_name 'house_in_the_hill'
6
+ description "This is a house in the hill"
7
+ amenities "gas: has it\ngos: has it too"
8
+ images_attributes {
9
+ {'0' =>
10
+ {'file' =>
11
+ Rack::Test::UploadedFile.new(Rails.root.join('spec/fixtures/image.jpg'), 'image/jpg')
12
+ }
13
+ }
14
+ }
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ #encoding: utf-8
2
+ FactoryGirl.define do
3
+ factory :property do
4
+ name 'House in the hill'
5
+ url_name 'house_in_the_hill'
6
+ description "This is a house in the hill"
7
+ neighborhood
8
+ latitude 10.00000
9
+ longitude 10.0000
10
+ address 'Evergreen rd 123'
11
+ public_address 'Around evergreen avenue'
12
+ covered_square_meters 10
13
+ uncovered_square_meters 10
14
+ rooms 4
15
+ bathrooms 4
16
+ amenities "gas: has it\ngos: has it too"
17
+ keywords "gas, house, hill"
18
+ for_rent true
19
+ for_sale false
20
+ images_attributes {
21
+ {'0' =>
22
+ {'file' =>
23
+ Rack::Test::UploadedFile.new(Rails.root.join('spec/fixtures/image.jpg'), 'image/jpg')
24
+ }
25
+ }
26
+ }
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe AdminUser do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Image do
4
+ it 'has an attachment' do
5
+ Image.new(
6
+ file: Rack::Test::UploadedFile.new(Rails.root.join('spec/fixtures/image.jpg'), 'image/jpg'),
7
+ position: 1
8
+ )
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Image do
4
+ it 'validates common factory' do
5
+ expect{ create :property }.not_to raise_exception
6
+ end
7
+ end
@@ -0,0 +1,22 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ require File.expand_path("../../config/environment", __FILE__)
3
+ require 'rspec/rails'
4
+ require 'email_spec'
5
+ require 'rspec/autorun'
6
+ require 'factory_girl_rails'
7
+ require 'capybara-webkit'
8
+ require 'capybara/rspec'
9
+ require 'capybara/rails'
10
+
11
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
12
+
13
+ RSpec.configure do |config|
14
+ config.include EmailSpec::Helpers
15
+ config.include EmailSpec::Matchers
16
+ config.include FactoryGirl::Syntax::Methods
17
+ config.include Devise::TestHelpers, :type => :controller
18
+
19
+ config.use_transactional_fixtures = true
20
+ config.infer_base_class_for_anonymous_controllers = false
21
+ config.order = "random"
22
+ end
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+ require 'rails/performance_test_help'
3
+
4
+ class BrowsingTest < ActionDispatch::PerformanceTest
5
+ # Refer to the documentation for all available options
6
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
+ # :output => 'tmp/performance', :formats => [:flat] }
8
+
9
+ def test_homepage
10
+ get '/'
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
+ #
8
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
+ # -- they do not yet inherit this setting
10
+ fixtures :all
11
+
12
+ # Add more helper methods to be used by all tests here...
13
+ end