message_train 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +51 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +83 -0
- data/Rakefile +71 -0
- data/VERSION +1 -0
- data/app/assets/javascripts/message_train.js +138 -0
- data/app/assets/stylesheets/message_train.scss +107 -0
- data/app/controllers/message_train/application_controller.rb +64 -0
- data/app/controllers/message_train/boxes_controller.rb +37 -0
- data/app/controllers/message_train/conversations_controller.rb +38 -0
- data/app/controllers/message_train/messages_controller.rb +74 -0
- data/app/controllers/message_train/participants_controller.rb +36 -0
- data/app/helpers/message_train/application_helper.rb +4 -0
- data/app/helpers/message_train/boxes_helper.rb +30 -0
- data/app/helpers/message_train/conversations_helper.rb +73 -0
- data/app/helpers/message_train/messages_helper.rb +58 -0
- data/app/models/message_train/attachment.rb +17 -0
- data/app/models/message_train/box.rb +268 -0
- data/app/models/message_train/conversation.rb +101 -0
- data/app/models/message_train/ignore.rb +18 -0
- data/app/models/message_train/message.rb +146 -0
- data/app/models/message_train/receipt.rb +70 -0
- data/app/views/application/404.html.haml +3 -0
- data/app/views/message_train/application/results.json.jbuilder +8 -0
- data/app/views/message_train/boxes/_dropdown_list.html.haml +5 -0
- data/app/views/message_train/boxes/_list_item.html.haml +5 -0
- data/app/views/message_train/boxes/_widget.html.haml +6 -0
- data/app/views/message_train/boxes/show.html.haml +47 -0
- data/app/views/message_train/conversations/_conversation.html.haml +9 -0
- data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -0
- data/app/views/message_train/conversations/_ignored_toggle.html.haml +4 -0
- data/app/views/message_train/conversations/_read_toggle.html.haml +4 -0
- data/app/views/message_train/conversations/_toggle.html.haml +1 -0
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +4 -0
- data/app/views/message_train/conversations/show.html.haml +11 -0
- data/app/views/message_train/conversations/show.json.jbuilder +2 -0
- data/app/views/message_train/messages/_deleted_toggle.html.haml +1 -0
- data/app/views/message_train/messages/_form.html.haml +8 -0
- data/app/views/message_train/messages/_message.html.haml +35 -0
- data/app/views/message_train/messages/_read_toggle.html.haml +4 -0
- data/app/views/message_train/messages/_toggle.html.haml +1 -0
- data/app/views/message_train/messages/_trashed_toggle.html.haml +4 -0
- data/app/views/message_train/messages/edit.html.haml +2 -0
- data/app/views/message_train/messages/new.html.haml +2 -0
- data/app/views/message_train/messages/show.json.jbuilder +2 -0
- data/app/views/message_train/participants/_field.html.haml +4 -0
- data/app/views/message_train/participants/_participant.json.jbuilder +5 -0
- data/app/views/message_train/participants/index.json.jbuilder +3 -0
- data/app/views/message_train/participants/show.json.jbuilder +1 -0
- data/bin/rails +12 -0
- data/config/initializers/bootstrap_pager_config.rb +10 -0
- data/config/initializers/date_time.rb +5 -0
- data/config/locales/en.yml +50 -0
- data/config/routes.rb +11 -0
- data/db/migrate/20150721145319_create_message_train_conversations.rb +9 -0
- data/db/migrate/20150721160322_create_message_train_messages.rb +14 -0
- data/db/migrate/20150721161144_create_message_train_attachments.rb +10 -0
- data/db/migrate/20150721161940_create_message_train_receipts.rb +16 -0
- data/db/migrate/20150721163838_create_message_train_ignores.rb +11 -0
- data/lib/generators/message_train/install/install_generator.rb +30 -0
- data/lib/generators/message_train/install/templates/initializer.rb +10 -0
- data/lib/generators/message_train/utils.rb +16 -0
- data/lib/message_train/configuration.rb +35 -0
- data/lib/message_train/engine.rb +19 -0
- data/lib/message_train/localization.rb +31 -0
- data/lib/message_train/mixin.rb +83 -0
- data/lib/message_train/version.rb +7 -0
- data/lib/message_train.rb +20 -0
- data/lib/tasks/message_train_tasks.rake +0 -0
- data/message_train.gemspec +325 -0
- data/night_train.gemspec +274 -0
- data/spec/controllers/message_train/boxes_controller_spec.rb +82 -0
- data/spec/controllers/message_train/conversations_controller_spec.rb +86 -0
- data/spec/controllers/message_train/messages_controller_spec.rb +210 -0
- data/spec/controllers/message_train/participants_controller_spec.rb +35 -0
- data/spec/dummy/.rspec +2 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/files/message_train/attachments/1917-Boys_Race_Above-Wiki.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/ACD_Silverbarn's_Mayumi.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/ACD_obedience.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/A_Man_and_His_Dog.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Alaskan_Malamute_agility_a-frame.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/American_water_spaniel_02.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Aport_konkurs_rybnik.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Askerhytta.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Bambisj.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Cattle_dog_skating.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Dog's_Olympics_training_ground_-_geograph.org.uk_-_660324.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/DogShowHierarchy.png +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Dog_weight_pull.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Draghuntpostcard.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Esham_51.JPG +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/FastCourseExample.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Fotos_joel_141.JPG +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Galgo_Spanish_male_brindle.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Golden-retriever-carlos-bei-der-dummyarbeit.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Habavk.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Haie_rci.svg +1714 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Hanging_18.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/Hundewa.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/K9ProSports_AttackOnHandler.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/K9ProSports_heel.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/K9Pro_Civil_agitation.JPG +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/TrainingSchutzhundRetrieveOverWall.jpg +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/example.pdf +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/letterlegal5.doc +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/pdf-sample.pdf +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/sample.pdf +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/tips.doc +0 -0
- data/spec/dummy/app/assets/files/message_train/attachments/wd-spectools-word-sample-04.doc +0 -0
- data/spec/dummy/app/assets/images/logo.svg +140 -0
- data/spec/dummy/app/assets/javascripts/application.js +17 -0
- data/spec/dummy/app/assets/stylesheets/application.css.scss +35 -0
- data/spec/dummy/app/controllers/application_controller.rb +14 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/group.rb +19 -0
- data/spec/dummy/app/models/role.rb +10 -0
- data/spec/dummy/app/models/user.rb +23 -0
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +5 -0
- data/spec/dummy/app/views/layouts/application.html.haml +29 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +40 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/bootstrap_leather.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/devise.rb +265 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/message_train.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/paperclip.rb +2 -0
- data/spec/dummy/config/initializers/rolify.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +60 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/unused/temporary_i18n_debugging.rb +12 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20150721140013_devise_create_users.rb +42 -0
- data/spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb +19 -0
- data/spec/dummy/db/migrate/20150721141128_create_groups.rb +11 -0
- data/spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb +6 -0
- data/spec/dummy/db/migrate/20150724142846_create_message_train_conversations.night_train.rb +10 -0
- data/spec/dummy/db/migrate/20150724142847_create_message_train_messages.night_train.rb +15 -0
- data/spec/dummy/db/migrate/20150724142848_create_message_train_attachments.night_train.rb +11 -0
- data/spec/dummy/db/migrate/20150724142849_create_message_train_receipts.night_train.rb +17 -0
- data/spec/dummy/db/migrate/20150724142850_create_message_train_ignores.night_train.rb +12 -0
- data/spec/dummy/db/schema.rb +121 -0
- data/spec/dummy/db/seeds/conversations.seeds.rb +86 -0
- data/spec/dummy/db/seeds/development/conversations.seeds.rb +9 -0
- data/spec/dummy/db/seeds/groups.seeds.rb +9 -0
- data/spec/dummy/db/seeds/test/conversations.seeds.rb +9 -0
- data/spec/dummy/db/seeds/users.seeds.rb +15 -0
- data/spec/dummy/db/seeds.rb +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/capybara.html +193 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/attachment.rb +6 -0
- data/spec/factories/group.rb +20 -0
- data/spec/factories/message.rb +68 -0
- data/spec/factories/user.rb +8 -0
- data/spec/features/boxes_spec.rb +50 -0
- data/spec/features/conversations_spec.rb +36 -0
- data/spec/features/messages_spec.rb +53 -0
- data/spec/helpers/message_train/boxes_helper_spec.rb +44 -0
- data/spec/message_train_spec.rb +7 -0
- data/spec/models/group_spec.rb +23 -0
- data/spec/models/message_train/attachment_spec.rb +12 -0
- data/spec/models/message_train/box_spec.rb +195 -0
- data/spec/models/message_train/conversation_spec.rb +98 -0
- data/spec/models/message_train/ignore_spec.rb +27 -0
- data/spec/models/message_train/message_spec.rb +83 -0
- data/spec/models/message_train/receipt_spec.rb +73 -0
- data/spec/models/user_spec.rb +68 -0
- data/spec/rails_helper.rb +83 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/controller_behaviors.rb +88 -0
- data/spec/support/controller_macros.rb +13 -0
- data/spec/support/conversations.rb +10 -0
- data/spec/support/factory_girl.rb +3 -0
- data/spec/support/feature_behaviors.rb +62 -0
- data/spec/support/groups.rb +3 -0
- data/spec/support/loaded_site.rb +5 -0
- data/spec/support/shared_connection.rb +13 -0
- data/spec/support/users.rb +6 -0
- data/spec/support/utilities.rb +8 -0
- data/vendor/assets/javascripts/bootstrap-tags.js +623 -0
- data/vendor/assets/stylesheets/bootstrap-tags.css +78 -0
- metadata +608 -0
data/night_train.gemspec
ADDED
@@ -0,0 +1,274 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: message_train 0.0.1 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "message_train"
|
9
|
+
s.version = "0.0.1"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Karen Lundgren"]
|
14
|
+
s.date = "2015-08-03"
|
15
|
+
s.description = "Private/public messaging for any object, such as Users or Groups"
|
16
|
+
s.email = "karen.e.lundgren@gmail.com"
|
17
|
+
s.executables = ["rails"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".rspec",
|
25
|
+
".ruby-gemset",
|
26
|
+
".ruby-version",
|
27
|
+
".travis.yml",
|
28
|
+
"Gemfile",
|
29
|
+
"LICENSE.txt",
|
30
|
+
"README.rdoc",
|
31
|
+
"Rakefile",
|
32
|
+
"VERSION",
|
33
|
+
"app/assets/javascripts/message_train.js",
|
34
|
+
"app/assets/stylesheets/message_train.css.scss",
|
35
|
+
"app/controllers/message_train/application_controller.rb",
|
36
|
+
"app/controllers/message_train/boxes_controller.rb",
|
37
|
+
"app/helpers/message_train/application_helper.rb",
|
38
|
+
"app/helpers/message_train/boxes_helper.rb",
|
39
|
+
"app/models/message_train/attachment.rb",
|
40
|
+
"app/models/message_train/box.rb",
|
41
|
+
"app/models/message_train/conversation.rb",
|
42
|
+
"app/models/message_train/ignore.rb",
|
43
|
+
"app/models/message_train/message.rb",
|
44
|
+
"app/models/message_train/receipt.rb",
|
45
|
+
"app/views/message_train/boxes/_dropdown_list.html.haml",
|
46
|
+
"app/views/message_train/boxes/_list_item.html.haml",
|
47
|
+
"app/views/message_train/boxes/_widget.html.haml",
|
48
|
+
"app/views/message_train/boxes/show.html.haml",
|
49
|
+
"bin/rails",
|
50
|
+
"config/locales/en.yml",
|
51
|
+
"config/routes.rb",
|
52
|
+
"db/migrate/20150721145319_create_message_train_conversations.rb",
|
53
|
+
"db/migrate/20150721160322_create_message_train_messages.rb",
|
54
|
+
"db/migrate/20150721161144_create_message_train_attachments.rb",
|
55
|
+
"db/migrate/20150721161940_create_message_train_receipts.rb",
|
56
|
+
"db/migrate/20150721163838_create_message_train_ignores.rb",
|
57
|
+
"lib/generators/message_train/install/install_generator.rb",
|
58
|
+
"lib/generators/message_train/install/templates/initializer.rb",
|
59
|
+
"lib/generators/message_train/utils.rb",
|
60
|
+
"lib/message_train.rb",
|
61
|
+
"lib/message_train/configuration.rb",
|
62
|
+
"lib/message_train/engine.rb",
|
63
|
+
"lib/message_train/localization.rb",
|
64
|
+
"lib/message_train/mixin.rb",
|
65
|
+
"lib/message_train/version.rb",
|
66
|
+
"lib/tasks/message_train_tasks.rake",
|
67
|
+
"message_train.gemspec",
|
68
|
+
"spec/controllers/message_train/boxes_controller_spec.rb",
|
69
|
+
"spec/dummy/.rspec",
|
70
|
+
"spec/dummy/Rakefile",
|
71
|
+
"spec/dummy/app/assets/files/message_train/attachments/1917-Boys_Race_Above-Wiki.jpg",
|
72
|
+
"spec/dummy/app/assets/files/message_train/attachments/ACD_Silverbarn's_Mayumi.jpg",
|
73
|
+
"spec/dummy/app/assets/files/message_train/attachments/ACD_obedience.jpg",
|
74
|
+
"spec/dummy/app/assets/files/message_train/attachments/A_Man_and_His_Dog.jpg",
|
75
|
+
"spec/dummy/app/assets/files/message_train/attachments/Alaskan_Malamute_agility_a-frame.jpg",
|
76
|
+
"spec/dummy/app/assets/files/message_train/attachments/American_water_spaniel_02.jpg",
|
77
|
+
"spec/dummy/app/assets/files/message_train/attachments/Aport_konkurs_rybnik.jpg",
|
78
|
+
"spec/dummy/app/assets/files/message_train/attachments/Askerhytta.jpg",
|
79
|
+
"spec/dummy/app/assets/files/message_train/attachments/Bambisj.jpg",
|
80
|
+
"spec/dummy/app/assets/files/message_train/attachments/Cattle_dog_skating.jpg",
|
81
|
+
"spec/dummy/app/assets/files/message_train/attachments/Dog's_Olympics_training_ground_-_geograph.org.uk_-_660324.jpg",
|
82
|
+
"spec/dummy/app/assets/files/message_train/attachments/DogShowHierarchy.png",
|
83
|
+
"spec/dummy/app/assets/files/message_train/attachments/Dog_weight_pull.jpg",
|
84
|
+
"spec/dummy/app/assets/files/message_train/attachments/Draghuntpostcard.jpg",
|
85
|
+
"spec/dummy/app/assets/files/message_train/attachments/Esham_51.JPG",
|
86
|
+
"spec/dummy/app/assets/files/message_train/attachments/FastCourseExample.jpg",
|
87
|
+
"spec/dummy/app/assets/files/message_train/attachments/Fotos_joel_141.JPG",
|
88
|
+
"spec/dummy/app/assets/files/message_train/attachments/Galgo_Spanish_male_brindle.jpg",
|
89
|
+
"spec/dummy/app/assets/files/message_train/attachments/Golden-retriever-carlos-bei-der-dummyarbeit.jpg",
|
90
|
+
"spec/dummy/app/assets/files/message_train/attachments/Habavk.jpg",
|
91
|
+
"spec/dummy/app/assets/files/message_train/attachments/Haie_rci.svg",
|
92
|
+
"spec/dummy/app/assets/files/message_train/attachments/Hanging_18.jpg",
|
93
|
+
"spec/dummy/app/assets/files/message_train/attachments/Hundewa.jpg",
|
94
|
+
"spec/dummy/app/assets/files/message_train/attachments/K9ProSports_AttackOnHandler.jpg",
|
95
|
+
"spec/dummy/app/assets/files/message_train/attachments/K9ProSports_heel.jpg",
|
96
|
+
"spec/dummy/app/assets/files/message_train/attachments/K9Pro_Civil_agitation.JPG",
|
97
|
+
"spec/dummy/app/assets/files/message_train/attachments/TrainingSchutzhundRetrieveOverWall.jpg",
|
98
|
+
"spec/dummy/app/assets/files/message_train/attachments/example.pdf",
|
99
|
+
"spec/dummy/app/assets/files/message_train/attachments/letterlegal5.doc",
|
100
|
+
"spec/dummy/app/assets/files/message_train/attachments/pdf-sample.pdf",
|
101
|
+
"spec/dummy/app/assets/files/message_train/attachments/sample.pdf",
|
102
|
+
"spec/dummy/app/assets/files/message_train/attachments/tips.doc",
|
103
|
+
"spec/dummy/app/assets/files/message_train/attachments/wd-spectools-word-sample-04.doc",
|
104
|
+
"spec/dummy/app/assets/images/logo.svg",
|
105
|
+
"spec/dummy/app/assets/javascripts/application.js",
|
106
|
+
"spec/dummy/app/assets/stylesheets/application.css.scss",
|
107
|
+
"spec/dummy/app/controllers/application_controller.rb",
|
108
|
+
"spec/dummy/app/helpers/application_helper.rb",
|
109
|
+
"spec/dummy/app/mailers/.keep",
|
110
|
+
"spec/dummy/app/models/.keep",
|
111
|
+
"spec/dummy/app/models/group.rb",
|
112
|
+
"spec/dummy/app/models/role.rb",
|
113
|
+
"spec/dummy/app/models/user.rb",
|
114
|
+
"spec/dummy/app/views/layouts/_top_navigation.html.haml",
|
115
|
+
"spec/dummy/app/views/layouts/application.html.haml",
|
116
|
+
"spec/dummy/bin/bundle",
|
117
|
+
"spec/dummy/bin/rails",
|
118
|
+
"spec/dummy/bin/rake",
|
119
|
+
"spec/dummy/bin/setup",
|
120
|
+
"spec/dummy/config.ru",
|
121
|
+
"spec/dummy/config/application.rb",
|
122
|
+
"spec/dummy/config/boot.rb",
|
123
|
+
"spec/dummy/config/database.yml",
|
124
|
+
"spec/dummy/config/environment.rb",
|
125
|
+
"spec/dummy/config/environments/development.rb",
|
126
|
+
"spec/dummy/config/environments/production.rb",
|
127
|
+
"spec/dummy/config/environments/test.rb",
|
128
|
+
"spec/dummy/config/initializers/assets.rb",
|
129
|
+
"spec/dummy/config/initializers/backtrace_silencers.rb",
|
130
|
+
"spec/dummy/config/initializers/bootstrap_leather.rb",
|
131
|
+
"spec/dummy/config/initializers/cookies_serializer.rb",
|
132
|
+
"spec/dummy/config/initializers/devise.rb",
|
133
|
+
"spec/dummy/config/initializers/filter_parameter_logging.rb",
|
134
|
+
"spec/dummy/config/initializers/inflections.rb",
|
135
|
+
"spec/dummy/config/initializers/mime_types.rb",
|
136
|
+
"spec/dummy/config/initializers/message_train.rb",
|
137
|
+
"spec/dummy/config/initializers/paperclip.rb",
|
138
|
+
"spec/dummy/config/initializers/rolify.rb",
|
139
|
+
"spec/dummy/config/initializers/session_store.rb",
|
140
|
+
"spec/dummy/config/initializers/wrap_parameters.rb",
|
141
|
+
"spec/dummy/config/locales/devise.en.yml",
|
142
|
+
"spec/dummy/config/locales/en.yml",
|
143
|
+
"spec/dummy/config/routes.rb",
|
144
|
+
"spec/dummy/config/secrets.yml",
|
145
|
+
"spec/dummy/db/development.sqlite3",
|
146
|
+
"spec/dummy/db/migrate/20150721140013_devise_create_users.rb",
|
147
|
+
"spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb",
|
148
|
+
"spec/dummy/db/migrate/20150721141128_create_groups.rb",
|
149
|
+
"spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb",
|
150
|
+
"spec/dummy/db/migrate/20150724142846_create_message_train_conversations.message_train.rb",
|
151
|
+
"spec/dummy/db/migrate/20150724142847_create_message_train_messages.message_train.rb",
|
152
|
+
"spec/dummy/db/migrate/20150724142848_create_message_train_attachments.message_train.rb",
|
153
|
+
"spec/dummy/db/migrate/20150724142849_create_message_train_receipts.message_train.rb",
|
154
|
+
"spec/dummy/db/migrate/20150724142850_create_message_train_ignores.message_train.rb",
|
155
|
+
"spec/dummy/db/schema.rb",
|
156
|
+
"spec/dummy/db/seeds.rb",
|
157
|
+
"spec/dummy/db/seeds/conversations.seeds.rb",
|
158
|
+
"spec/dummy/db/seeds/groups.seeds.rb",
|
159
|
+
"spec/dummy/db/seeds/users.seeds.rb",
|
160
|
+
"spec/dummy/db/test.sqlite3",
|
161
|
+
"spec/dummy/lib/assets/.keep",
|
162
|
+
"spec/dummy/log/.keep",
|
163
|
+
"spec/dummy/public/404.html",
|
164
|
+
"spec/dummy/public/422.html",
|
165
|
+
"spec/dummy/public/500.html",
|
166
|
+
"spec/dummy/public/favicon.ico",
|
167
|
+
"spec/factories/attachment.rb",
|
168
|
+
"spec/factories/group.rb",
|
169
|
+
"spec/factories/message.rb",
|
170
|
+
"spec/factories/user.rb",
|
171
|
+
"spec/features/boxes_spec.rb",
|
172
|
+
"spec/helpers/message_train/boxes_helper_spec.rb",
|
173
|
+
"spec/models/group_spec.rb",
|
174
|
+
"spec/models/message_train/attachment_spec.rb",
|
175
|
+
"spec/models/message_train/box_spec.rb",
|
176
|
+
"spec/models/message_train/conversation_spec.rb",
|
177
|
+
"spec/models/message_train/ignore_spec.rb",
|
178
|
+
"spec/models/message_train/message_spec.rb",
|
179
|
+
"spec/models/message_train/receipt_spec.rb",
|
180
|
+
"spec/models/user_spec.rb",
|
181
|
+
"spec/message_train_spec.rb",
|
182
|
+
"spec/rails_helper.rb",
|
183
|
+
"spec/routing/message_train/boxes_routing_spec.rb",
|
184
|
+
"spec/spec_helper.rb",
|
185
|
+
"spec/support/controller_behaviors.rb",
|
186
|
+
"spec/support/controller_macros.rb",
|
187
|
+
"spec/support/conversations.rb",
|
188
|
+
"spec/support/factory_girl.rb",
|
189
|
+
"spec/support/feature_behaviors.rb",
|
190
|
+
"spec/support/groups.rb",
|
191
|
+
"spec/support/loaded_site.rb",
|
192
|
+
"spec/support/users.rb"
|
193
|
+
]
|
194
|
+
s.homepage = "http://www.gemvein.com/museum/cases/message_train"
|
195
|
+
s.licenses = ["MIT"]
|
196
|
+
s.rubygems_version = "2.4.5"
|
197
|
+
s.summary = "Messaging for any object"
|
198
|
+
|
199
|
+
if s.respond_to? :specification_version then
|
200
|
+
s.specification_version = 4
|
201
|
+
|
202
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
203
|
+
s.add_runtime_dependency(%q<rails>, ["~> 4"])
|
204
|
+
s.add_runtime_dependency(%q<paperclip>, ["~> 4.3"])
|
205
|
+
s.add_runtime_dependency(%q<rails-i18n>, ["~> 4"])
|
206
|
+
s.add_runtime_dependency(%q<haml-rails>, ["~> 0.9"])
|
207
|
+
s.add_runtime_dependency(%q<jquery-rails>, ["~> 4"])
|
208
|
+
s.add_runtime_dependency(%q<uglifier>, ["~> 2.7"])
|
209
|
+
s.add_runtime_dependency(%q<bootstrap_leather>, ["~> 0.8"])
|
210
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
211
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
212
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
213
|
+
s.add_development_dependency(%q<sqlite3>, ["~> 1.3"])
|
214
|
+
s.add_development_dependency(%q<devise>, ["~> 3.5"])
|
215
|
+
s.add_development_dependency(%q<rolify>, ["~> 4"])
|
216
|
+
s.add_development_dependency(%q<faker>, ["~> 1.4"])
|
217
|
+
s.add_development_dependency(%q<rspec-rails>, ["~> 3.2"])
|
218
|
+
s.add_development_dependency(%q<rspec-its>, ["~> 1.2"])
|
219
|
+
s.add_development_dependency(%q<factory_girl_rails>, ["~> 4.5"])
|
220
|
+
s.add_development_dependency(%q<seedbank>, ["~> 0.3"])
|
221
|
+
s.add_development_dependency(%q<friendly_id>, ["~> 5"])
|
222
|
+
s.add_development_dependency(%q<byebug>, ["~> 5"])
|
223
|
+
s.add_development_dependency(%q<sass-rails>, ["~> 5"])
|
224
|
+
s.add_development_dependency(%q<bootstrap-sass>, ["~> 3.3"])
|
225
|
+
else
|
226
|
+
s.add_dependency(%q<rails>, ["~> 4"])
|
227
|
+
s.add_dependency(%q<paperclip>, ["~> 4.3"])
|
228
|
+
s.add_dependency(%q<rails-i18n>, ["~> 4"])
|
229
|
+
s.add_dependency(%q<haml-rails>, ["~> 0.9"])
|
230
|
+
s.add_dependency(%q<jquery-rails>, ["~> 4"])
|
231
|
+
s.add_dependency(%q<uglifier>, ["~> 2.7"])
|
232
|
+
s.add_dependency(%q<bootstrap_leather>, ["~> 0.8"])
|
233
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
234
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
235
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
236
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3"])
|
237
|
+
s.add_dependency(%q<devise>, ["~> 3.5"])
|
238
|
+
s.add_dependency(%q<rolify>, ["~> 4"])
|
239
|
+
s.add_dependency(%q<faker>, ["~> 1.4"])
|
240
|
+
s.add_dependency(%q<rspec-rails>, ["~> 3.2"])
|
241
|
+
s.add_dependency(%q<rspec-its>, ["~> 1.2"])
|
242
|
+
s.add_dependency(%q<factory_girl_rails>, ["~> 4.5"])
|
243
|
+
s.add_dependency(%q<seedbank>, ["~> 0.3"])
|
244
|
+
s.add_dependency(%q<friendly_id>, ["~> 5"])
|
245
|
+
s.add_dependency(%q<byebug>, ["~> 5"])
|
246
|
+
s.add_dependency(%q<sass-rails>, ["~> 5"])
|
247
|
+
s.add_dependency(%q<bootstrap-sass>, ["~> 3.3"])
|
248
|
+
end
|
249
|
+
else
|
250
|
+
s.add_dependency(%q<rails>, ["~> 4"])
|
251
|
+
s.add_dependency(%q<paperclip>, ["~> 4.3"])
|
252
|
+
s.add_dependency(%q<rails-i18n>, ["~> 4"])
|
253
|
+
s.add_dependency(%q<haml-rails>, ["~> 0.9"])
|
254
|
+
s.add_dependency(%q<jquery-rails>, ["~> 4"])
|
255
|
+
s.add_dependency(%q<uglifier>, ["~> 2.7"])
|
256
|
+
s.add_dependency(%q<bootstrap_leather>, ["~> 0.8"])
|
257
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
258
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
259
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
260
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3"])
|
261
|
+
s.add_dependency(%q<devise>, ["~> 3.5"])
|
262
|
+
s.add_dependency(%q<rolify>, ["~> 4"])
|
263
|
+
s.add_dependency(%q<faker>, ["~> 1.4"])
|
264
|
+
s.add_dependency(%q<rspec-rails>, ["~> 3.2"])
|
265
|
+
s.add_dependency(%q<rspec-its>, ["~> 1.2"])
|
266
|
+
s.add_dependency(%q<factory_girl_rails>, ["~> 4.5"])
|
267
|
+
s.add_dependency(%q<seedbank>, ["~> 0.3"])
|
268
|
+
s.add_dependency(%q<friendly_id>, ["~> 5"])
|
269
|
+
s.add_dependency(%q<byebug>, ["~> 5"])
|
270
|
+
s.add_dependency(%q<sass-rails>, ["~> 5"])
|
271
|
+
s.add_dependency(%q<bootstrap-sass>, ["~> 3.3"])
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe MessageTrain::BoxesController do
|
4
|
+
include_context 'loaded site'
|
5
|
+
include ControllerMacros
|
6
|
+
routes { MessageTrain::Engine.routes }
|
7
|
+
|
8
|
+
let(:valid_params) { { 'conversations' => {unread_conversation.id.to_s => unread_conversation.id} } }
|
9
|
+
let(:invalid_params) { { 'conversations' => {'999' => 999} } }
|
10
|
+
|
11
|
+
before do
|
12
|
+
login_user first_user
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "GET #show" do
|
16
|
+
before do
|
17
|
+
get :show, division: 'in'
|
18
|
+
end
|
19
|
+
it_should_behave_like 'a successful page', which_renders: 'show'
|
20
|
+
|
21
|
+
context 'loads box into @box' do
|
22
|
+
subject { assigns(:box) }
|
23
|
+
it { should be_a MessageTrain::Box }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'loads conversations into @conversations' do
|
27
|
+
subject { assigns(:conversations) }
|
28
|
+
its(:first) { should be_a MessageTrain::Conversation }
|
29
|
+
it { should have_at_least(2).items }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "PATCH/PUT #update" do
|
34
|
+
describe 'with invalid params' do
|
35
|
+
before do
|
36
|
+
put :update, division: 'in', mark_to_set: 'read', objects: invalid_params
|
37
|
+
end
|
38
|
+
it_should_behave_like 'a page with an error message', "Conversation 999 not found in box"
|
39
|
+
end
|
40
|
+
describe 'without params' do
|
41
|
+
before do
|
42
|
+
put :update, division: 'in'
|
43
|
+
end
|
44
|
+
it_should_behave_like 'a page with an alert message', 'Nothing to do'
|
45
|
+
end
|
46
|
+
describe 'with valid params' do
|
47
|
+
before do
|
48
|
+
put :update, division: 'in', mark_to_set: 'read', objects: valid_params
|
49
|
+
end
|
50
|
+
it_should_behave_like 'a page with a notice message', 'Update successful'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "DELETE #destroy" do
|
55
|
+
describe 'with invalid params' do
|
56
|
+
before do
|
57
|
+
delete :destroy, division: 'in', mark_to_set: 'ignore', objects: invalid_params
|
58
|
+
end
|
59
|
+
it_should_behave_like 'a page with an error message', "Conversation 999 not found in box"
|
60
|
+
end
|
61
|
+
describe 'without params' do
|
62
|
+
before do
|
63
|
+
delete :destroy, division: 'in'
|
64
|
+
end
|
65
|
+
it_should_behave_like 'a page with an alert message', 'Nothing to do'
|
66
|
+
end
|
67
|
+
describe 'with valid params' do
|
68
|
+
context 'ignoring' do
|
69
|
+
before do
|
70
|
+
delete :destroy, division: 'in', mark_to_set: 'ignore', objects: valid_params
|
71
|
+
end
|
72
|
+
it_should_behave_like 'a page with a notice message', 'Update successful'
|
73
|
+
end
|
74
|
+
context 'unignoring' do
|
75
|
+
before do
|
76
|
+
delete :destroy, division: 'in', mark_to_set: 'unignore', objects: valid_params
|
77
|
+
end
|
78
|
+
it_should_behave_like 'a page with a notice message', 'Update successful'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe MessageTrain::ConversationsController do
|
4
|
+
include_context 'loaded site'
|
5
|
+
include ControllerMacros
|
6
|
+
routes { MessageTrain::Engine.routes }
|
7
|
+
|
8
|
+
let(:valid_params) { { 'messages' => {unread_conversation.messages.first.id.to_s => unread_conversation.messages.first.id} } }
|
9
|
+
let(:invalid_params) { { 'messages' => {'999999' => 999999} } }
|
10
|
+
|
11
|
+
before do
|
12
|
+
login_user first_user
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "GET #show" do
|
16
|
+
before do
|
17
|
+
get :show, box_division: 'in', id: unread_conversation.id
|
18
|
+
end
|
19
|
+
it_should_behave_like 'a successful page', which_renders: 'show'
|
20
|
+
|
21
|
+
context 'loads box into @box' do
|
22
|
+
subject { assigns(:box) }
|
23
|
+
it { should be_a MessageTrain::Box }
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'loads conversation into @conversation' do
|
27
|
+
subject { assigns(:conversation) }
|
28
|
+
it { should eq unread_conversation }
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'loads messages into @messages' do
|
32
|
+
subject { assigns(:messages) }
|
33
|
+
it { should include unread_conversation.messages.first }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "PATCH/PUT #update" do
|
38
|
+
describe 'with invalid params' do
|
39
|
+
before do
|
40
|
+
put :update, box_division: 'in', id: unread_conversation.id, mark_to_set: 'read', objects: invalid_params
|
41
|
+
end
|
42
|
+
it_should_behave_like 'a page with an error message', "Message 999999 not found in box"
|
43
|
+
end
|
44
|
+
describe 'without params' do
|
45
|
+
before do
|
46
|
+
put :update, box_division: 'in', id: unread_conversation.id
|
47
|
+
end
|
48
|
+
it_should_behave_like 'a page with an alert message', 'Nothing to do'
|
49
|
+
end
|
50
|
+
describe 'with valid params' do
|
51
|
+
before do
|
52
|
+
put :update, box_division: 'in', id: unread_conversation.id, mark_to_set: 'read', objects: valid_params
|
53
|
+
end
|
54
|
+
it_should_behave_like 'a page with a notice message', 'Update successful'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "DELETE #destroy" do
|
59
|
+
describe 'with invalid params' do
|
60
|
+
before do
|
61
|
+
delete :destroy, box_division: 'in', id: 999, mark_to_set: 'ignore'
|
62
|
+
end
|
63
|
+
it_should_behave_like 'a 404 Not Found error'
|
64
|
+
end
|
65
|
+
describe 'without params' do
|
66
|
+
before do
|
67
|
+
delete :destroy, box_division: 'in', id: unread_conversation.id
|
68
|
+
end
|
69
|
+
it_should_behave_like 'a page with an alert message', 'Nothing to do'
|
70
|
+
end
|
71
|
+
describe 'with valid params' do
|
72
|
+
context 'ignoring' do
|
73
|
+
before do
|
74
|
+
delete :destroy, box_division: 'in', id: unread_conversation.id, mark_to_set: 'ignore'
|
75
|
+
end
|
76
|
+
it_should_behave_like 'a page with a notice message', 'Update successful'
|
77
|
+
end
|
78
|
+
context 'unignoring' do
|
79
|
+
before do
|
80
|
+
delete :destroy, box_division: 'in', id: unread_conversation.id, mark_to_set: 'unignore'
|
81
|
+
end
|
82
|
+
it_should_behave_like 'a page with a notice message', 'Update successful'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,210 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe MessageTrain::MessagesController do
|
4
|
+
include_context 'loaded site'
|
5
|
+
include ControllerMacros
|
6
|
+
routes { MessageTrain::Engine.routes }
|
7
|
+
|
8
|
+
# This should return the minimal set of attributes required to create a valid
|
9
|
+
# Dog. As you add validations to Dog, be sure to
|
10
|
+
# adjust the attributes here as well.
|
11
|
+
let(:valid_attributes) {
|
12
|
+
{ subject: 'Test Subject', recipients_to_save: {'users' => 'second-user, third-user'}, draft: false }
|
13
|
+
}
|
14
|
+
|
15
|
+
let(:draft_attributes) {
|
16
|
+
{ subject: 'Test Subject', recipients_to_save: {'users' => ''} }
|
17
|
+
}
|
18
|
+
|
19
|
+
let(:invalid_attributes) {
|
20
|
+
{ subject: nil }
|
21
|
+
}
|
22
|
+
|
23
|
+
let(:draft_message) { draft_conversation.messages.first }
|
24
|
+
|
25
|
+
before do
|
26
|
+
login_user first_user
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "GET #show" do
|
30
|
+
before do
|
31
|
+
get :show, box_division: 'in', id: unread_conversation.messages.first.id, format: :json
|
32
|
+
end
|
33
|
+
it_should_behave_like 'a successful page', which_renders: 'show'
|
34
|
+
|
35
|
+
context 'loads box into @box' do
|
36
|
+
subject { assigns(:box) }
|
37
|
+
it { should be_a MessageTrain::Box }
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'loads message into @message' do
|
41
|
+
subject { assigns(:message) }
|
42
|
+
it { should eq unread_conversation.messages.first }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "GET #new" do
|
47
|
+
before do
|
48
|
+
get :new, box_division: 'in', conversation_id: unread_conversation.messages.first.conversation_id
|
49
|
+
end
|
50
|
+
it_should_behave_like 'a successful page', which_renders: 'new'
|
51
|
+
|
52
|
+
context 'loads box into @box' do
|
53
|
+
subject { assigns(:box) }
|
54
|
+
it { should be_a MessageTrain::Box }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'loads message into @message' do
|
58
|
+
subject { assigns(:message) }
|
59
|
+
it { should be_a_new MessageTrain::Message }
|
60
|
+
its(:subject) { should eq 'Re: Unread Conversation' }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "GET #edit" do
|
65
|
+
describe 'as someone other than the owner' do
|
66
|
+
before do
|
67
|
+
get :edit, box_division: 'in', id: someone_elses_conversation.messages.first.id
|
68
|
+
end
|
69
|
+
it_should_behave_like 'a 404 Not Found error'
|
70
|
+
end
|
71
|
+
describe 'as the owner' do
|
72
|
+
describe 'when message is a not a draft' do
|
73
|
+
before do
|
74
|
+
get :edit, box_division: 'in', id: unread_conversation.messages.first.id
|
75
|
+
end
|
76
|
+
it_should_behave_like 'a 404 Not Found error'
|
77
|
+
end
|
78
|
+
describe 'when message is a draft' do
|
79
|
+
before do
|
80
|
+
get :edit, box_division: 'in', id: draft_message.id
|
81
|
+
end
|
82
|
+
it_should_behave_like 'a successful page', which_renders: 'edit'
|
83
|
+
|
84
|
+
context 'loads requested message into @message' do
|
85
|
+
subject { assigns(:message) }
|
86
|
+
it { should eq draft_message }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "POST #create" do
|
93
|
+
describe 'with valid attributes' do
|
94
|
+
describe 'when draft' do
|
95
|
+
before do
|
96
|
+
post :create, box_division: 'in', message: draft_attributes
|
97
|
+
end
|
98
|
+
it_should_behave_like 'a redirect to', '/box/drafts'
|
99
|
+
it_should_behave_like 'a response without error'
|
100
|
+
|
101
|
+
context "sets the flash with an alert of the messages's draft status" do
|
102
|
+
subject { flash[:alert] }
|
103
|
+
it { should eq 'Message saved as draft.'}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
describe 'when not draft' do
|
107
|
+
before do
|
108
|
+
post :create, box_division: 'in', message: valid_attributes
|
109
|
+
end
|
110
|
+
it_should_behave_like 'a redirect to', '/box/sent'
|
111
|
+
it_should_behave_like 'a response without error'
|
112
|
+
|
113
|
+
context "sets the flash with a notice of the messages's creation" do
|
114
|
+
subject { flash[:notice] }
|
115
|
+
it { should eq 'Message sent.'}
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
describe 'with valid attributes, counting' do
|
120
|
+
it 'results in a new message' do
|
121
|
+
expect { post :create, box_division: 'in', message: valid_attributes }.to change { MessageTrain::Message.count }.by(1)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
describe 'with invalid params' do
|
125
|
+
before do
|
126
|
+
post :create, box_division: 'in', message: invalid_attributes
|
127
|
+
end
|
128
|
+
it_should_behave_like 'a successful page', which_renders: 'new'
|
129
|
+
|
130
|
+
context 'loads the given message into @message' do
|
131
|
+
subject { assigns(:message) }
|
132
|
+
it { should be_a_new(MessageTrain::Message).with(invalid_attributes) }
|
133
|
+
end
|
134
|
+
|
135
|
+
context "sets the flash with the message's errors" do
|
136
|
+
subject { flash[:error] }
|
137
|
+
it { should eq "Subject can't be blank"}
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe 'with invalid params, counting' do
|
142
|
+
it 'does not result in a new message' do
|
143
|
+
expect { post :create, box_division: 'in', message: invalid_attributes }.to_not change { MessageTrain::Message.count }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "PUT #update" do
|
149
|
+
describe 'as someone other than the owner' do
|
150
|
+
before do
|
151
|
+
put :update, box_division: 'in', id: someone_elses_conversation.messages.first.id, message: valid_attributes
|
152
|
+
end
|
153
|
+
it_should_behave_like 'a 404 Not Found error'
|
154
|
+
end
|
155
|
+
describe 'as the owner' do
|
156
|
+
describe 'with invalid params' do
|
157
|
+
before do
|
158
|
+
put :update, box_division: 'in', id: draft_message.id, message: invalid_attributes
|
159
|
+
end
|
160
|
+
it_should_behave_like 'a successful page', which_renders: 'edit'
|
161
|
+
|
162
|
+
context 'loads the given message into @message' do
|
163
|
+
subject { assigns(:message) }
|
164
|
+
it { should eq draft_message }
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'does not update @message' do
|
168
|
+
subject { draft_message.reload }
|
169
|
+
its(:subject) { should eq 'This should turn into a draft' }
|
170
|
+
end
|
171
|
+
|
172
|
+
context "sets the flash with the message's errors" do
|
173
|
+
subject { flash[:error] }
|
174
|
+
it { should eq "Subject can't be blank"}
|
175
|
+
end
|
176
|
+
end
|
177
|
+
describe 'with valid params' do
|
178
|
+
describe 'when not a draft' do
|
179
|
+
before do
|
180
|
+
put :update, box_division: 'in', id: sent_conversation.messages.first.id, message: valid_attributes
|
181
|
+
end
|
182
|
+
it_should_behave_like 'a 404 Not Found error'
|
183
|
+
end
|
184
|
+
describe 'when a draft' do
|
185
|
+
before do
|
186
|
+
put :update, box_division: 'in', id: draft_message.id, message: valid_attributes
|
187
|
+
end
|
188
|
+
it_should_behave_like 'a redirect to', '/box/sent'
|
189
|
+
it_should_behave_like 'a response without error'
|
190
|
+
|
191
|
+
context 'updates @message' do
|
192
|
+
subject { draft_message.reload }
|
193
|
+
its(:subject) { should eq 'Test Subject' }
|
194
|
+
end
|
195
|
+
|
196
|
+
context "sets no alert" do
|
197
|
+
subject { flash[:alert] }
|
198
|
+
it { should be nil }
|
199
|
+
end
|
200
|
+
|
201
|
+
context "sets the flash with a notice of the message's update" do
|
202
|
+
subject { flash[:notice] }
|
203
|
+
it { should eq 'Message sent.'}
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|