notifly 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. metadata +1 -69
  3. data/.editorconfig +0 -22
  4. data/.rspec +0 -2
  5. data/.travis.yml +0 -13
  6. data/Gemfile +0 -24
  7. data/Gemfile.lock +0 -199
  8. data/VERSION +0 -1
  9. data/app/assets/images/notifly/.keep +0 -0
  10. data/spec/controllers/notifly/notifications_controller_spec.rb +0 -44
  11. data/spec/dummy/README.rdoc +0 -28
  12. data/spec/dummy/Rakefile +0 -6
  13. data/spec/dummy/app/assets/images/.keep +0 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +0 -14
  15. data/spec/dummy/app/assets/stylesheets/application.css +0 -20
  16. data/spec/dummy/app/controllers/application_controller.rb +0 -13
  17. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  18. data/spec/dummy/app/controllers/site_controller.rb +0 -4
  19. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  20. data/spec/dummy/app/mailers/.keep +0 -0
  21. data/spec/dummy/app/models/.keep +0 -0
  22. data/spec/dummy/app/models/concerns/.keep +0 -0
  23. data/spec/dummy/app/models/dummy_object.rb +0 -19
  24. data/spec/dummy/app/models/post.rb +0 -21
  25. data/spec/dummy/app/views/layouts/application.html.erb +0 -15
  26. data/spec/dummy/app/views/site/index.html.erb +0 -2
  27. data/spec/dummy/bin/bundle +0 -3
  28. data/spec/dummy/bin/rails +0 -4
  29. data/spec/dummy/bin/rake +0 -4
  30. data/spec/dummy/config.ru +0 -4
  31. data/spec/dummy/config/application.rb +0 -29
  32. data/spec/dummy/config/boot.rb +0 -5
  33. data/spec/dummy/config/database.exemple.yml +0 -12
  34. data/spec/dummy/config/database.travis.yml +0 -4
  35. data/spec/dummy/config/environment.rb +0 -5
  36. data/spec/dummy/config/environments/development.rb +0 -37
  37. data/spec/dummy/config/environments/production.rb +0 -78
  38. data/spec/dummy/config/environments/test.rb +0 -39
  39. data/spec/dummy/config/initializers/assets.rb +0 -8
  40. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  41. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  43. data/spec/dummy/config/initializers/inflections.rb +0 -16
  44. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  45. data/spec/dummy/config/initializers/session_store.rb +0 -3
  46. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  47. data/spec/dummy/config/locales/en.yml +0 -23
  48. data/spec/dummy/config/routes.rb +0 -5
  49. data/spec/dummy/config/secrets.yml +0 -22
  50. data/spec/dummy/db/migrate/20141031165049_create_dummy_objects.rb +0 -9
  51. data/spec/dummy/db/migrate/20141103191353_create_posts.rb +0 -10
  52. data/spec/dummy/db/migrate/20141104121318_add_dummy_to_post.rb +0 -5
  53. data/spec/dummy/db/schema.rb +0 -54
  54. data/spec/dummy/lib/assets/.keep +0 -0
  55. data/spec/dummy/log/.keep +0 -0
  56. data/spec/dummy/public/404.html +0 -67
  57. data/spec/dummy/public/422.html +0 -67
  58. data/spec/dummy/public/500.html +0 -66
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/spec/dummy/spec/features/notifly/counter_spec.rb +0 -38
  61. data/spec/dummy/spec/features/notifly/loading_notifications_spec.rb +0 -38
  62. data/spec/dummy/spec/features/notifly/read_notifications_spec.rb +0 -70
  63. data/spec/dummy/spec/models/dummy_object_spec.rb +0 -58
  64. data/spec/dummy/spec/models/post_spec.rb +0 -89
  65. data/spec/models/notifly/notification_spec.rb +0 -18
  66. data/spec/rails_helper.rb +0 -21
  67. data/spec/spec_helper.rb +0 -62
  68. data/spec/support/shared_connection.rb +0 -14
  69. data/spec/support/suppress_log.rb +0 -3
  70. data/spec/support/wait_ajax.rb +0 -53
@@ -1,14 +0,0 @@
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] if respond_to?(:wrap_parameters)
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,23 +0,0 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
21
-
22
- en:
23
- hello: "Hello world"
@@ -1,5 +0,0 @@
1
- Rails.application.routes.draw do
2
- mount Notifly::Engine => '/notifly', as: 'notifly'
3
-
4
- root to: 'site#index'
5
- end
@@ -1,22 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure the secrets in this file are kept private
11
- # if you're sharing your code publicly.
12
-
13
- development:
14
- secret_key_base: 9444b7aeea2219e0b4bc563cb1129f0064e1caa65562545d7c851f32135adad914a90d111a5510f29552317c4171fde77e08e61ba4797d19f75693ef76d7f26e
15
-
16
- test:
17
- secret_key_base: 0012b892a47e20248312bce6225eb806629e22739bdea6e0cf91a57656085c05735cd02b4378495df903d6b31a0666f0f90ba5728aa41e8fe3d4b208cb24bb75
18
-
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
21
- production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -1,9 +0,0 @@
1
- class CreateDummyObjects < ActiveRecord::Migration
2
- def change
3
- create_table :dummy_objects do |t|
4
- t.string :name
5
-
6
- t.timestamps
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- class CreatePosts < ActiveRecord::Migration
2
- def change
3
- create_table :posts do |t|
4
- t.string :author
5
- t.string :title
6
- t.text :content
7
- t.boolean :published, default: false
8
- end
9
- end
10
- end
@@ -1,5 +0,0 @@
1
- class AddDummyToPost < ActiveRecord::Migration
2
- def change
3
- add_reference :posts, :dummy_object, index: true
4
- end
5
- end
@@ -1,54 +0,0 @@
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 that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20141117193436) do
15
-
16
- # These are extensions that must be enabled in order to support this database
17
- enable_extension "plpgsql"
18
-
19
- create_table "dummy_objects", force: true do |t|
20
- t.string "name"
21
- t.datetime "created_at"
22
- t.datetime "updated_at"
23
- end
24
-
25
- create_table "notifly_notifications", force: true do |t|
26
- t.string "template"
27
- t.boolean "read", default: false
28
- t.integer "target_id"
29
- t.string "target_type"
30
- t.integer "sender_id"
31
- t.string "sender_type"
32
- t.integer "receiver_id"
33
- t.string "receiver_type"
34
- t.datetime "created_at"
35
- t.datetime "updated_at"
36
- t.text "data"
37
- t.boolean "seen", default: false
38
- end
39
-
40
- add_index "notifly_notifications", ["receiver_id", "receiver_type"], name: "index_notifly_notifications_on_receiver_id_and_receiver_type", using: :btree
41
- add_index "notifly_notifications", ["sender_id", "sender_type"], name: "index_notifly_notifications_on_sender_id_and_sender_type", using: :btree
42
- add_index "notifly_notifications", ["target_id", "target_type"], name: "index_notifly_notifications_on_target_id_and_target_type", using: :btree
43
-
44
- create_table "posts", force: true do |t|
45
- t.string "author"
46
- t.string "title"
47
- t.text "content"
48
- t.boolean "published", default: false
49
- t.integer "dummy_object_id"
50
- end
51
-
52
- add_index "posts", ["dummy_object_id"], name: "index_posts_on_dummy_object_id", using: :btree
53
-
54
- end
File without changes
File without changes
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/422.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The change you wanted was rejected.</h1>
62
- <p>Maybe you tried to change something you didn't have access to.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/500.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>We're sorry, but something went wrong.</h1>
62
- </div>
63
- <p>If you are the application owner check the logs for more information.</p>
64
- </div>
65
- </body>
66
- </html>
File without changes
@@ -1,38 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe 'Notifly counter', :type => :feature, js: true do
4
- before(:each) do
5
- receiver = DummyObject.create! name: 'User'
6
- Notifly::Notification.create! receiver: receiver, seen: true, read: false
7
- Notifly::Notification.create! receiver: receiver, seen: false, read: false
8
- Notifly::Notification.create! receiver: receiver, seen: false, read: false
9
- Notifly::Notification.create! receiver: receiver, seen: false, read: false
10
- Notifly::Notification.create! receiver: DummyObject.create!, seen: false, read: false
11
- Notifly::Notification.create! receiver: DummyObject.create!, seen: false, read: false
12
- Notifly.per_page = 2
13
-
14
- visit root_path
15
- end
16
-
17
- after(:each) do
18
- Notifly.per_page = 10
19
- end
20
-
21
- scenario 'seeing notifications' do
22
- within("#notifly-counter") do
23
- expect(page).to have_content '3'
24
- end
25
-
26
- wait_for_ajax { find('#notifly-icon').click }
27
-
28
- within("#notifly-counter") do
29
- expect(page).to have_content '1'
30
- end
31
-
32
- click_ajax_link 'More'
33
-
34
- within("#notifly-counter") do
35
- expect(page).to_not have_content '1'
36
- end
37
- end
38
- end
@@ -1,38 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe 'Loading notifications', :type => :feature, js: true do
4
- before(:each) do
5
- @receiver = DummyObject.create! name: 'User'
6
- 13.times { Notifly::Notification.create! receiver: @receiver, template: :default, read: false }
7
- Notifly::Notification.create! receiver: DummyObject.create!, template: :default
8
- Notifly::Notification.create! receiver: DummyObject.create!, template: :default
9
- visit root_path
10
- end
11
-
12
- scenario 'loading notifications in background when user hover notifly' do
13
- within("#notifly") do
14
- expect(page).to_not have_css('div.notifly-notification', visible: false)
15
- end
16
-
17
- wait_for_ajax { find('#notifly-icon').click }
18
-
19
- within('#notifly') do
20
- expect(page).to have_css('div.notifly-notification', count: 10, visible: false)
21
- end
22
- end
23
-
24
- scenario 'loading next page link' do
25
- href_with_page = notifly.notifications_path(page: 2)
26
- wait_for_ajax { find('#notifly-icon').click }
27
- within('#notifly-notifications-footer') do
28
- expect(page).to have_xpath("//a[@href=\"#{href_with_page}\"]")
29
- end
30
-
31
-
32
- click_ajax_link 'More'
33
-
34
- within('#notifly-notifications-footer') do
35
- expect(page).to_not have_xpath("//a[@href=\"#{href_with_page}\"]")
36
- end
37
- end
38
- end
@@ -1,70 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe 'Read notification', :type => :feature, js: true do
4
- before do
5
- @receiver = DummyObject.create! name: 'User'
6
- @n_1 = Notifly::Notification.create! receiver: @receiver, read: false
7
- @n_2 = Notifly::Notification.create! receiver: @receiver, read: false
8
- @n_3 = Notifly::Notification.create! receiver: @receiver, read: false
9
- Notifly.per_page = 2
10
- end
11
-
12
- after(:each) do
13
- Notifly.per_page = 10
14
- end
15
-
16
- let(:open_notifly) do
17
- visit root_path
18
- wait_for_ajax { find('#notifly-icon').click }
19
- end
20
-
21
- context 'when read a specific notification' do
22
- scenario 'read a notification' do
23
- open_notifly
24
-
25
- notification_id = "#notifly-notification-#{@n_2.id}"
26
- expect(page).to have_selector ("#{notification_id}.notifly-notification-not-read")
27
-
28
- within(notification_id) do
29
- click_ajax_link 'read'
30
- end
31
-
32
- expect(page).to have_selector (notification_id)
33
- expect(page).to_not have_selector ("#{notification_id}.notifly-notification-not-read")
34
- end
35
-
36
- scenario 'unread a notification' do
37
- notification = Notifly::Notification.create! receiver: @receiver, read: true
38
- notification_id = "#notifly-notification-#{notification.id}"
39
- open_notifly
40
- expect(page).to have_selector (notification_id)
41
- expect(page).to_not have_selector ("#{notification_id}.notifly-notification-not-read")
42
-
43
- within(notification_id) do
44
- click_ajax_link 'unread'
45
- end
46
-
47
- expect(page).to have_selector ("#{notification_id}.notifly-notification-not-read")
48
- end
49
- end
50
-
51
- scenario 'mark all read' do
52
- open_notifly
53
-
54
- expect(page).to have_selector ("#notifly-notification-#{@n_3.id}.notifly-notification-not-read")
55
- expect(page).to have_selector ("#notifly-notification-#{@n_2.id}.notifly-notification-not-read")
56
- expect(page).to_not have_selector ("#notifly-notification-#{@n_1.id}")
57
-
58
- within('#notifly') do
59
- click_ajax_link 'Mark as read'
60
- click_ajax_link 'More'
61
- end
62
-
63
- expect(page).to have_selector ("#notifly-notification-#{@n_3.id}")
64
- expect(page).to have_selector ("#notifly-notification-#{@n_2.id}")
65
- expect(page).to have_selector ("#notifly-notification-#{@n_1.id}.notifly-notification-not-read")
66
-
67
- expect(page).to_not have_selector ("#notifly-notification-#{@n_3.id}.notifly-notification-not-read")
68
- expect(page).to_not have_selector ("#notifly-notification-#{@n_2.id}.notifly-notification-not-read")
69
- end
70
- end