citygate 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/README.rdoc +11 -0
  2. data/app/assets/javascripts/citygate/admin_users.coffee +1 -1
  3. data/app/assets/javascripts/citygate/jquery.pjax.js +4 -2
  4. data/app/assets/javascripts/citygate.js +16 -0
  5. data/app/assets/stylesheets/citygate/{application.css.scss → application.css} +0 -0
  6. data/app/assets/stylesheets/citygate/main.sass +0 -9
  7. data/app/controllers/citygate/admin/application_controller.rb +3 -1
  8. data/app/controllers/citygate/admin/users_controller.rb +4 -4
  9. data/app/controllers/citygate/application_controller.rb +4 -2
  10. data/app/controllers/citygate/users/omniauth_callbacks_controller.rb +13 -12
  11. data/app/models/citygate/permission.rb +7 -0
  12. data/app/models/citygate/role.rb +2 -1
  13. data/app/models/citygate/user.rb +24 -4
  14. data/app/views/citygate/admin/users/index.html.erb +3 -3
  15. data/app/views/citygate/admin/users/show.html.erb +12 -3
  16. data/app/views/citygate/home/index.html.erb +4 -5
  17. data/app/views/citygate/shared/_navigation.html.erb +18 -18
  18. data/app/views/citygate/users/show.html.erb +6 -4
  19. data/app/views/devise/confirmations/new.html.erb +12 -0
  20. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  21. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  22. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  23. data/app/views/devise/passwords/edit.html.erb +16 -0
  24. data/app/views/devise/passwords/new.html.erb +12 -0
  25. data/app/views/devise/registrations/edit.html.erb +33 -30
  26. data/app/views/devise/registrations/new.html.erb +10 -10
  27. data/app/views/devise/sessions/new.html.erb +18 -0
  28. data/app/views/devise/{_links.erb → shared/_links.erb} +7 -7
  29. data/app/views/devise/unlocks/new.html.erb +12 -0
  30. data/app/views/layouts/admin/application.html.erb +2 -2
  31. data/config/accounts.yml +1 -3
  32. data/config/initializers/devise.rb +1 -1
  33. data/config/locales/defaults/en.yml +2 -0
  34. data/config/locales/models/user/en.yml +4 -0
  35. data/config/locales/navigation/en.yml +12 -0
  36. data/config/locales/shared/cancan/en.yml +3 -0
  37. data/config/locales/{devise.en.yml → shared/devise/devise.en.yml} +0 -0
  38. data/config/locales/{devise_invitable.en.yml → shared/devise/devise_invitable.en.yml} +0 -0
  39. data/config/locales/views/admin/users/en.yml +32 -0
  40. data/db/migrate/20120303195103_add_name_to_users.rb +2 -1
  41. data/db/migrate/20120727143920_create_permissions_table.rb +12 -0
  42. data/db/seeds.rb +14 -0
  43. data/lib/ability.rb +53 -0
  44. data/lib/citygate/engine.rb +10 -0
  45. data/lib/citygate/version.rb +1 -1
  46. data/spec/dummy/README.rdoc +261 -0
  47. data/spec/dummy/Rakefile +30 -0
  48. data/{app/assets/javascripts/citygate → spec/dummy/app/assets/javascripts}/application.js +2 -3
  49. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  50. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  51. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  52. data/spec/dummy/app/views/layouts/application.html.erb +19 -0
  53. data/spec/dummy/config/application.rb +61 -0
  54. data/spec/dummy/config/boot.rb +10 -0
  55. data/spec/dummy/config/database.yml +25 -0
  56. data/spec/dummy/config/environment.rb +5 -0
  57. data/spec/dummy/config/environments/development.rb +39 -0
  58. data/spec/dummy/config/environments/production.rb +67 -0
  59. data/spec/dummy/config/environments/test.rb +39 -0
  60. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  61. data/spec/dummy/config/initializers/inflections.rb +15 -0
  62. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  63. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  64. data/spec/dummy/config/initializers/session_store.rb +8 -0
  65. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  66. data/{config → spec/dummy/config}/locales/en.yml +0 -0
  67. data/spec/dummy/config/routes.rb +3 -0
  68. data/spec/dummy/config.ru +4 -0
  69. data/spec/dummy/db/development.sqlite3 +0 -0
  70. data/spec/dummy/db/migrate/20120706095546_devise_create_users.citygate.rb +50 -0
  71. data/spec/dummy/db/migrate/20120706095547_add_name_to_users.citygate.rb +7 -0
  72. data/spec/dummy/db/migrate/20120706095548_add_confirmable_to_users.citygate.rb +12 -0
  73. data/spec/dummy/db/migrate/20120706095549_devise_invitable_add_to_users.citygate.rb +24 -0
  74. data/spec/dummy/db/migrate/20120706095550_add_omniauth_to_devise.citygate.rb +20 -0
  75. data/spec/dummy/db/migrate/20120706095551_create_roles.citygate.rb +11 -0
  76. data/spec/dummy/db/migrate/20120727145840_create_permissions_table.citygate.rb +13 -0
  77. data/spec/dummy/db/production.sqlite3 +0 -0
  78. data/spec/dummy/db/schema.rb +79 -0
  79. data/spec/dummy/db/seeds.rb +1 -0
  80. data/spec/dummy/db/test.sqlite3 +0 -0
  81. data/spec/dummy/features/step_definitions/email_steps.rb +206 -0
  82. data/spec/dummy/features/step_definitions/user_steps.rb +249 -0
  83. data/spec/dummy/features/support/email_spec.rb +1 -0
  84. data/spec/dummy/features/support/env.rb +107 -0
  85. data/spec/dummy/features/support/hooks.rb +0 -0
  86. data/spec/dummy/features/support/paths.rb +46 -0
  87. data/spec/dummy/features/users/login_omniauth.feature +19 -0
  88. data/spec/dummy/features/users/sign_in.feature +40 -0
  89. data/spec/dummy/features/users/sign_out.feature +11 -0
  90. data/spec/dummy/features/users/sign_up.feature +27 -0
  91. data/spec/dummy/features/users/user_edit.feature +9 -0
  92. data/spec/dummy/features/users/users_admin.feature +44 -0
  93. data/spec/dummy/log/development.log +18417 -0
  94. data/spec/dummy/log/test.log +59087 -0
  95. data/spec/dummy/public/404.html +26 -0
  96. data/spec/dummy/public/422.html +26 -0
  97. data/spec/dummy/public/500.html +25 -0
  98. data/spec/dummy/public/favicon.ico +0 -0
  99. data/spec/dummy/script/rails +6 -0
  100. data/spec/dummy/spec/controllers/admin/admin_controller_spec.rb +10 -0
  101. data/spec/dummy/spec/controllers/admin/users_spec.rb +15 -0
  102. data/spec/dummy/spec/controllers/home_controller_spec.rb +12 -0
  103. data/spec/dummy/spec/controllers/omniauth_spec.rb +73 -0
  104. data/spec/dummy/spec/factories.rb +33 -0
  105. data/spec/dummy/spec/javascripts/UserSpec.js +14 -0
  106. data/spec/dummy/spec/javascripts/fixtures/user_listing.html +20 -0
  107. data/spec/dummy/spec/javascripts/helpers/SpecHelper.js +9 -0
  108. data/spec/dummy/spec/javascripts/helpers/jasmine-jquery.js +306 -0
  109. data/spec/dummy/spec/javascripts/helpers/jquery.min.js +4 -0
  110. data/spec/dummy/spec/javascripts/support/jasmine.yml +19 -0
  111. data/spec/dummy/spec/models/user_spec.rb +100 -0
  112. data/spec/dummy/spec/routing/routing_spec.rb +22 -0
  113. data/spec/dummy/spec/spec_helper.rb +79 -0
  114. data/spec/dummy/spec/support/devise.rb +3 -0
  115. data/spec/dummy/tmp/cache/assets/C63/E40/sprockets%2F36a675f52eb281488964b58be8971051 +0 -0
  116. data/spec/dummy/tmp/cache/assets/C79/FC0/sprockets%2F76c2f8ffd1175afd6274640057134300 +0 -0
  117. data/spec/dummy/tmp/cache/assets/C7A/CE0/sprockets%2F9124c83a02e7332a90b2883b69f81d04 +0 -0
  118. data/spec/dummy/tmp/cache/assets/C89/540/sprockets%2F606a455261f8f047c994c4b9a582f126 +0 -0
  119. data/spec/dummy/tmp/cache/assets/CC5/020/sprockets%2Ffa39f3f719158fea829829617391b42c +0 -0
  120. data/spec/dummy/tmp/cache/assets/CD6/2B0/sprockets%2F08e01b4122e606428c6de7234d87bee1 +0 -0
  121. data/spec/dummy/tmp/cache/assets/CD8/070/sprockets%2F3afc9406d6d06c238a33603363af8a66 +0 -0
  122. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  123. data/spec/dummy/tmp/cache/assets/CE2/7D0/sprockets%2Fe69b8c4ca0800c940d1d9785f1a92327 +0 -0
  124. data/spec/dummy/tmp/cache/assets/CE8/510/sprockets%2F0d85ab6e3972f70636a990e91fec8301 +0 -0
  125. data/spec/dummy/tmp/cache/assets/CF6/500/sprockets%2Fe48376f3339fc2f84ac25d713936ea99 +0 -0
  126. data/spec/dummy/tmp/cache/assets/D0D/DE0/sprockets%2Fa35442f02b0b2479f22d83d639d8c4fd +0 -0
  127. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  128. data/spec/dummy/tmp/cache/assets/D3E/710/sprockets%2F93251497334cafddb54ecc36a332f5b9 +0 -0
  129. data/spec/dummy/tmp/cache/assets/D48/410/sprockets%2Fa18aa9c28f587c76e162489eb19f2a2a +0 -0
  130. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  131. data/spec/dummy/tmp/cache/assets/D53/840/sprockets%2Ff753499d8cefbb5a8450ca97540ff275 +0 -0
  132. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  133. data/spec/dummy/tmp/cache/assets/D72/580/sprockets%2F02aed4ae7c633d6d577280de93c4c7c6 +0 -0
  134. data/spec/dummy/tmp/cache/assets/D73/010/sprockets%2F834fa37dfa7f28148e125baf3f9d91b0 +0 -0
  135. data/spec/dummy/tmp/cache/assets/D75/530/sprockets%2F6a480d7952fbe8ce5c2eaad0369f7271 +0 -0
  136. data/spec/dummy/tmp/cache/assets/D78/BD0/sprockets%2Fd0c9ac69560ea197444b7f759ecd06da +0 -0
  137. data/spec/dummy/tmp/cache/assets/D9B/0B0/sprockets%2F609a6d0b06eb3752679f6e1f0adcb4fc +0 -0
  138. data/spec/dummy/tmp/cache/assets/D9E/F10/sprockets%2F9ab223df888d724dcad09eb1163cc5f4 +0 -0
  139. data/spec/dummy/tmp/cache/assets/D9E/F70/sprockets%2Fc5d4a6e7d907804c52cbf910339dafdb +0 -0
  140. data/spec/dummy/tmp/cache/assets/DB9/2A0/sprockets%2F0a7332e4e1420de7165bd13ecffca4cc +0 -0
  141. data/spec/dummy/tmp/cache/assets/DC2/210/sprockets%2Ff0049a44fff3a6ea3a55283aceb06fb4 +0 -0
  142. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  143. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  144. data/spec/dummy/tmp/cache/assets/E0B/AF0/sprockets%2Ff71f3afdedf8ab892f147a5facc07488 +0 -0
  145. data/spec/dummy/tmp/cache/assets/E2B/670/sprockets%2Feac21904ecb266ce92aecadb8681b7fe +0 -0
  146. data/spec/spec_helper.rb +33 -0
  147. metadata +267 -41
  148. data/app/models/citygate/ability.rb +0 -31
@@ -0,0 +1,39 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+
38
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
39
+ end
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,39 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+
38
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
39
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '26ce4aaba0953194f815b754b1964227170abb4b065b345bf8a580f71ce72ed73e5c7fdfa5ffcc1dde7eafda4d759c2d0a379b6e90f257846c26fd74af3812d8'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount Citygate::Engine => "/"
3
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
Binary file
@@ -0,0 +1,50 @@
1
+ # This migration comes from citygate (originally 20120303195052)
2
+ class DeviseCreateUsers < ActiveRecord::Migration
3
+ def change
4
+ create_table(:citygate_users) do |t|
5
+ ## Database authenticatable
6
+ t.string :email, :null => false, :default => ""
7
+ t.string :encrypted_password, :null => false, :default => ""
8
+
9
+ ## Recoverable
10
+ t.string :reset_password_token
11
+ t.datetime :reset_password_sent_at
12
+
13
+ ## Rememberable
14
+ t.datetime :remember_created_at
15
+
16
+ ## Trackable
17
+ t.integer :sign_in_count, :default => 0
18
+ t.datetime :current_sign_in_at
19
+ t.datetime :last_sign_in_at
20
+ t.string :current_sign_in_ip
21
+ t.string :last_sign_in_ip
22
+
23
+ ## Encryptable
24
+ # t.string :password_salt
25
+
26
+ ## Confirmable
27
+ # t.string :confirmation_token
28
+ # t.datetime :confirmed_at
29
+ # t.datetime :confirmation_sent_at
30
+ # t.string :unconfirmed_email # Only if using reconfirmable
31
+
32
+ ## Lockable
33
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
34
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
35
+ # t.datetime :locked_at
36
+
37
+ ## Token authenticatable
38
+ # t.string :authentication_token
39
+
40
+
41
+ t.timestamps
42
+ end
43
+
44
+ add_index :citygate_users, :email, :unique => true
45
+ add_index :citygate_users, :reset_password_token, :unique => true
46
+ # add_index :users, :confirmation_token, :unique => true
47
+ # add_index :users, :unlock_token, :unique => true
48
+ # add_index :users, :authentication_token, :unique => true
49
+ end
50
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from citygate (originally 20120303195103)
2
+ class AddNameToUsers < ActiveRecord::Migration
3
+ def change
4
+ add_column :citygate_users, :first_name, :string
5
+ add_column :citygate_users, :last_name, :string
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from citygate (originally 20120303195111)
2
+ class AddConfirmableToUsers < ActiveRecord::Migration
3
+ def change
4
+ add_column :citygate_users, :confirmation_token, :string
5
+
6
+ add_column :citygate_users, :confirmed_at, :datetime
7
+
8
+ add_column :citygate_users, :confirmation_sent_at, :datetime
9
+
10
+ add_column :citygate_users, :unconfirmed_email, :string
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ # This migration comes from citygate (originally 20120303195145)
2
+ class DeviseInvitableAddToUsers < ActiveRecord::Migration
3
+ def up
4
+ change_table :citygate_users do |t|
5
+ t.string :invitation_token, :limit => 60
6
+ t.datetime :invitation_sent_at
7
+ t.datetime :invitation_accepted_at
8
+ t.integer :invitation_limit
9
+ t.references :invited_by, :polymorphic => true
10
+ t.index :invitation_token # for invitable
11
+ t.index :invited_by_id
12
+ end
13
+
14
+ # And allow null encrypted_password and password_salt:
15
+ change_column_null :citygate_users, :encrypted_password, true
16
+ end
17
+
18
+ def down
19
+ change_table :citygate_users do |t|
20
+ t.remove_references :invited_by, :polymorphic => true
21
+ t.remove :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # This migration comes from citygate (originally 20120507112430)
2
+ class AddOmniauthToDevise < ActiveRecord::Migration
3
+ def change
4
+ add_index :citygate_users, :confirmation_token, :unique => true
5
+ add_column :citygate_users , :password_salt, :string
6
+
7
+ create_table :citygate_authorizations do |t|
8
+ t.string :provider
9
+ t.string :uid
10
+ t.integer :user_id
11
+ t.string :token
12
+ t.string :secret
13
+ t.string :name
14
+ t.string :link
15
+ t.string :image_url
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from citygate (originally 20120523163700)
2
+ class CreateRoles < ActiveRecord::Migration
3
+ def change
4
+ create_table :citygate_roles do |t|
5
+ t.string :name
6
+ t.timestamps
7
+ end
8
+
9
+ add_column :citygate_users, :role_id, :integer
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # This migration comes from citygate (originally 20120727143920)
2
+ class CreatePermissionsTable < ActiveRecord::Migration
3
+ def change
4
+ create_table :citygate_permissions do |t|
5
+ t.string :action, :null => false
6
+ t.string :subject_class, :null => false
7
+ t.string :subject_id
8
+ t.integer :role_id
9
+ end
10
+
11
+ add_index :citygate_permissions, :role_id
12
+ end
13
+ end
File without changes
@@ -0,0 +1,79 @@
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 => 20120727145840) do
15
+
16
+ create_table "citygate_authorizations", :force => true do |t|
17
+ t.string "provider"
18
+ t.string "uid"
19
+ t.integer "user_id"
20
+ t.string "token"
21
+ t.string "secret"
22
+ t.string "name"
23
+ t.string "link"
24
+ t.string "image_url"
25
+ t.datetime "created_at", :null => false
26
+ t.datetime "updated_at", :null => false
27
+ end
28
+
29
+ create_table "citygate_permissions", :force => true do |t|
30
+ t.string "action", :null => false
31
+ t.string "subject_class", :null => false
32
+ t.string "subject_id"
33
+ t.integer "role_id"
34
+ end
35
+
36
+ add_index "citygate_permissions", ["role_id"], :name => "index_citygate_permissions_on_role_id"
37
+
38
+ create_table "citygate_roles", :force => true do |t|
39
+ t.string "name"
40
+ t.datetime "created_at", :null => false
41
+ t.datetime "updated_at", :null => false
42
+ end
43
+
44
+ create_table "citygate_users", :force => true do |t|
45
+ t.string "email", :default => "", :null => false
46
+ t.string "encrypted_password", :default => ""
47
+ t.string "reset_password_token"
48
+ t.datetime "reset_password_sent_at"
49
+ t.datetime "remember_created_at"
50
+ t.integer "sign_in_count", :default => 0
51
+ t.datetime "current_sign_in_at"
52
+ t.datetime "last_sign_in_at"
53
+ t.string "current_sign_in_ip"
54
+ t.string "last_sign_in_ip"
55
+ t.datetime "created_at", :null => false
56
+ t.datetime "updated_at", :null => false
57
+ t.string "first_name"
58
+ t.string "last_name"
59
+ t.string "confirmation_token"
60
+ t.datetime "confirmed_at"
61
+ t.datetime "confirmation_sent_at"
62
+ t.string "unconfirmed_email"
63
+ t.string "invitation_token", :limit => 60
64
+ t.datetime "invitation_sent_at"
65
+ t.datetime "invitation_accepted_at"
66
+ t.integer "invitation_limit"
67
+ t.integer "invited_by_id"
68
+ t.string "invited_by_type"
69
+ t.string "password_salt"
70
+ t.integer "role_id"
71
+ end
72
+
73
+ add_index "citygate_users", ["confirmation_token"], :name => "index_citygate_users_on_confirmation_token", :unique => true
74
+ add_index "citygate_users", ["email"], :name => "index_citygate_users_on_email", :unique => true
75
+ add_index "citygate_users", ["invitation_token"], :name => "index_citygate_users_on_invitation_token"
76
+ add_index "citygate_users", ["invited_by_id"], :name => "index_citygate_users_on_invited_by_id"
77
+ add_index "citygate_users", ["reset_password_token"], :name => "index_citygate_users_on_reset_password_token", :unique => true
78
+
79
+ end
@@ -0,0 +1 @@
1
+ Citygate::Engine.load_seed
Binary file
@@ -0,0 +1,206 @@
1
+ # Commonly used email steps
2
+ #
3
+ # To add your own steps make a custom_email_steps.rb
4
+ # The provided methods are:
5
+ #
6
+ # last_email_address
7
+ # reset_mailer
8
+ # open_last_email
9
+ # visit_in_email
10
+ # unread_emails_for
11
+ # mailbox_for
12
+ # current_email
13
+ # open_email
14
+ # read_emails_for
15
+ # find_email
16
+ #
17
+ # General form for email scenarios are:
18
+ # - clear the email queue (done automatically by email_spec)
19
+ # - execute steps that sends an email
20
+ # - check the user received an/no/[0-9] emails
21
+ # - open the email
22
+ # - inspect the email contents
23
+ # - interact with the email (e.g. click links)
24
+ #
25
+ # The Cucumber steps below are setup in this order.
26
+
27
+ module EmailHelpers
28
+ def current_email_address
29
+ # Replace with your a way to find your current email. e.g @current_user.email
30
+ # last_email_address will return the last email address used by email spec to find an email.
31
+ # Note that last_email_address will be reset after each Scenario.
32
+ last_email_address || "example@example.com"
33
+ end
34
+ end
35
+
36
+ World(EmailHelpers)
37
+
38
+ #
39
+ # Reset the e-mail queue within a scenario.
40
+ # This is done automatically before each scenario.
41
+ #
42
+
43
+ Given /^(?:a clear email queue|no emails have been sent)$/ do
44
+ reset_mailer
45
+ end
46
+
47
+ #
48
+ # Check how many emails have been sent/received
49
+ #
50
+
51
+ Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount|
52
+ unread_emails_for(address).size.should == parse_email_count(amount)
53
+ end
54
+
55
+ Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amount|
56
+ mailbox_for(address).size.should == parse_email_count(amount)
57
+ end
58
+
59
+ Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject|
60
+ unread_emails_for(address).select { |m| m.subject =~ Regexp.new(Regexp.escape(subject)) }.size.should == parse_email_count(amount)
61
+ end
62
+
63
+ Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject \/([^"]*?)\/$/ do |address, amount, subject|
64
+ unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size.should == parse_email_count(amount)
65
+ end
66
+
67
+ Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
68
+ open_email(address, :with_text => expected_body)
69
+ end
70
+
71
+ #
72
+ # Accessing emails
73
+ #
74
+
75
+ # Opens the most recently received email
76
+ When /^(?:I|they|"([^"]*?)") opens? the email$/ do |address|
77
+ open_email(address)
78
+ end
79
+
80
+ When /^(?:I|they|"([^"]*?)") opens? the email with subject "([^"]*?)"$/ do |address, subject|
81
+ open_email(address, :with_subject => subject)
82
+ end
83
+
84
+ When /^(?:I|they|"([^"]*?)") opens? the email with subject \/([^"]*?)\/$/ do |address, subject|
85
+ open_email(address, :with_subject => Regexp.new(subject))
86
+ end
87
+
88
+ When /^(?:I|they|"([^"]*?)") opens? the email with text "([^"]*?)"$/ do |address, text|
89
+ open_email(address, :with_text => text)
90
+ end
91
+
92
+ When /^(?:I|they|"([^"]*?)") opens? the email with text \/([^"]*?)\/$/ do |address, text|
93
+ open_email(address, :with_text => Regexp.new(text))
94
+ end
95
+
96
+ #
97
+ # Inspect the Email Contents
98
+ #
99
+
100
+ Then /^(?:I|they) should see "([^"]*?)" in the email subject$/ do |text|
101
+ current_email.should have_subject(text)
102
+ end
103
+
104
+ Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text|
105
+ current_email.should have_subject(Regexp.new(text))
106
+ end
107
+
108
+ Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text|
109
+ current_email.default_part_body.to_s.should include(text)
110
+ end
111
+
112
+ Then /^(?:I|they) should see \/([^"]*?)\/ in the email body$/ do |text|
113
+ current_email.default_part_body.to_s.should =~ Regexp.new(text)
114
+ end
115
+
116
+ Then /^(?:I|they) should see the email delivered from "([^"]*?)"$/ do |text|
117
+ current_email.should be_delivered_from(text)
118
+ end
119
+
120
+ Then /^(?:I|they) should see "([^\"]*)" in the email "([^"]*?)" header$/ do |text, name|
121
+ current_email.should have_header(name, text)
122
+ end
123
+
124
+ Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |text, name|
125
+ current_email.should have_header(name, Regexp.new(text))
126
+ end
127
+
128
+ Then /^I should see it is a multi\-part email$/ do
129
+ current_email.should be_multipart
130
+ end
131
+
132
+ Then /^(?:I|they) should see "([^"]*?)" in the email html part body$/ do |text|
133
+ current_email.html_part.body.to_s.should include(text)
134
+ end
135
+
136
+ Then /^(?:I|they) should see "([^"]*?)" in the email text part body$/ do |text|
137
+ current_email.text_part.body.to_s.should include(text)
138
+ end
139
+
140
+ #
141
+ # Inspect the Email Attachments
142
+ #
143
+
144
+ Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amount|
145
+ current_email_attachments.size.should == parse_email_count(amount)
146
+ end
147
+
148
+ Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
149
+ current_email_attachments.select { |a| a.filename == filename }.size.should == parse_email_count(amount)
150
+ end
151
+
152
+ Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
153
+ current_email_attachments[(index.to_i - 1)].filename.should == filename
154
+ end
155
+
156
+ Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
157
+ current_email_attachments.select { |a| a.content_type.include?(content_type) }.size.should == parse_email_count(amount)
158
+ end
159
+
160
+ Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
161
+ current_email_attachments[(index.to_i - 1)].content_type.should include(content_type)
162
+ end
163
+
164
+ Then /^all attachments should not be blank$/ do
165
+ current_email_attachments.each do |attachment|
166
+ attachment.read.size.should_not == 0
167
+ end
168
+ end
169
+
170
+ Then /^show me a list of email attachments$/ do
171
+ EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email)
172
+ end
173
+
174
+ #
175
+ # Interact with Email Contents
176
+ #
177
+
178
+ When /^(?:I|they) follow "([^"]*?)" in the email$/ do |link|
179
+ visit_in_email(link)
180
+ end
181
+
182
+ When /^(?:I|they) click the first link in the email$/ do
183
+ click_first_link_in_email
184
+ end
185
+
186
+ #
187
+ # Debugging
188
+ # These only work with Rails and OSx ATM since EmailViewer uses RAILS_ROOT and OSx's 'open' command.
189
+ # Patches accepted. ;)
190
+ #
191
+
192
+ Then /^save and open current email$/ do
193
+ EmailSpec::EmailViewer::save_and_open_email(current_email)
194
+ end
195
+
196
+ Then /^save and open all text emails$/ do
197
+ EmailSpec::EmailViewer::save_and_open_all_text_emails
198
+ end
199
+
200
+ Then /^save and open all html emails$/ do
201
+ EmailSpec::EmailViewer::save_and_open_all_html_emails
202
+ end
203
+
204
+ Then /^save and open all raw emails$/ do
205
+ EmailSpec::EmailViewer::save_and_open_all_raw_emails
206
+ end