mention_system 0.0.6

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 (68) hide show
  1. checksums.yaml +7 -0
  2. data/.empty +0 -0
  3. data/.gitignore +15 -0
  4. data/.keep +0 -0
  5. data/.rspec +2 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +23 -0
  9. data/Appraisals +7 -0
  10. data/Gemfile +4 -0
  11. data/LICENSE.txt +22 -0
  12. data/README.md +170 -0
  13. data/Rakefile +8 -0
  14. data/gemfiles/.empty +0 -0
  15. data/gemfiles/.gitignore +0 -0
  16. data/gemfiles/.keep +0 -0
  17. data/gemfiles/rails4.1.gemfile +7 -0
  18. data/gemfiles/rails4.2.gemfile +7 -0
  19. data/lib/.empty +0 -0
  20. data/lib/.gitignore +0 -0
  21. data/lib/.keep +0 -0
  22. data/lib/generators/.empty +0 -0
  23. data/lib/generators/.gitignore +0 -0
  24. data/lib/generators/.keep +0 -0
  25. data/lib/generators/mention_system/.empty +0 -0
  26. data/lib/generators/mention_system/.gitignore +0 -0
  27. data/lib/generators/mention_system/.keep +0 -0
  28. data/lib/generators/mention_system/mention_system_generator.rb +46 -0
  29. data/lib/generators/mention_system/templates/.empty +0 -0
  30. data/lib/generators/mention_system/templates/.gitignore +0 -0
  31. data/lib/generators/mention_system/templates/.keep +0 -0
  32. data/lib/generators/mention_system/templates/migration.rb +47 -0
  33. data/lib/mention_system.rb +46 -0
  34. data/lib/mention_system/.empty +0 -0
  35. data/lib/mention_system/.gitignore +0 -0
  36. data/lib/mention_system/.keep +0 -0
  37. data/lib/mention_system/mention.rb +155 -0
  38. data/lib/mention_system/mention_processor.rb +141 -0
  39. data/lib/mention_system/mentionee.rb +58 -0
  40. data/lib/mention_system/mentioner.rb +88 -0
  41. data/lib/mention_system/version.rb +12 -0
  42. data/mention_system.gemspec +31 -0
  43. data/spec/.empty +0 -0
  44. data/spec/.gitignore +0 -0
  45. data/spec/.keep +0 -0
  46. data/spec/db/.empty +0 -0
  47. data/spec/db/.gitignore +0 -0
  48. data/spec/db/.keep +0 -0
  49. data/spec/db/migrate/.empty +0 -0
  50. data/spec/db/migrate/.gitignore +0 -0
  51. data/spec/db/migrate/.keep +0 -0
  52. data/spec/db/migrate/20140926000000_create_mentions.rb +47 -0
  53. data/spec/db/migrate/20140926000005_create_dummy_mentioners.rb +22 -0
  54. data/spec/db/migrate/20140926000010_create_dummy_mentionees.rb +22 -0
  55. data/spec/mention_system/.empty +0 -0
  56. data/spec/mention_system/.gitignore +0 -0
  57. data/spec/mention_system/.keep +0 -0
  58. data/spec/mention_system/mention_processor_spec.rb +155 -0
  59. data/spec/mention_system/mention_spec.rb +177 -0
  60. data/spec/mention_system/mentionee_spec.rb +69 -0
  61. data/spec/mention_system/mentioner_spec.rb +96 -0
  62. data/spec/spec_helper.rb +116 -0
  63. data/spec/support/.empty +0 -0
  64. data/spec/support/.gitignore +0 -0
  65. data/spec/support/.keep +0 -0
  66. data/spec/support/active_record.rb +12 -0
  67. data/spec/support/shoulda_matchers.rb +2 -0
  68. metadata +240 -0
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ ###
4
+ # Shared examples for MentionSystem::Mentionee
5
+ ###
6
+ shared_examples_for MentionSystem::Mentionee do
7
+ ###
8
+ # Let mentionee be DummyMentionee.create
9
+ ###
10
+ let(:mentionee) { DummyMentionee.create }
11
+
12
+ ###
13
+ # Let mentioner be DummyMentioner.create
14
+ ###
15
+ let(:mentioner) { DummyMentioner.create }
16
+
17
+ ###
18
+ # Describes associations
19
+ ###
20
+ describe "associations" do
21
+ ###
22
+ # Should have many mentioners
23
+ ###
24
+ it "should have many mentioners" do
25
+ should have_many(:mentioners)
26
+ end
27
+ end
28
+
29
+ ###
30
+ # Describes class methods
31
+ ###
32
+ describe "class methods" do
33
+ ###
34
+ # Should be a mentionee
35
+ ###
36
+ it "should be a mentionee" do
37
+ expect(mentionee.is_mentionee?).to equal(true)
38
+ end
39
+
40
+ ###
41
+ # Should be mentioned by a mentioner
42
+ ###
43
+ it "should specify if is mentioned by a mentioner" do
44
+ expect(MentionSystem::Mention).to receive(:mentions?).with(mentioner, mentionee) { true }
45
+
46
+ expect(mentionee.mentioned_by?(mentioner)).to equal(true)
47
+ end
48
+
49
+ ###
50
+ # Should scope mentioners filtered by mentioner type
51
+ ###
52
+ it "should scope mentioners filtered by mentioner type" do
53
+ scope = MentionSystem::Mention.scope_by_mentionee(mentionee).scope_by_mentioner_type(DummyMentioner)
54
+
55
+ expect(mentionee.mentioners_by(DummyMentioner)).to eq(scope)
56
+ end
57
+ end
58
+ end
59
+
60
+ ###
61
+ # Describes DummyMentionee
62
+ ###
63
+ describe DummyMentionee do
64
+ ###
65
+ # It behaves like MentionSystem::Mentionee
66
+ ###
67
+ it_behaves_like MentionSystem::Mentionee
68
+ end
69
+
@@ -0,0 +1,96 @@
1
+ require 'spec_helper'
2
+
3
+ ###
4
+ # Shared examples for MentionSystem::Mentioner
5
+ ###
6
+ shared_examples_for MentionSystem::Mentioner do
7
+ ###
8
+ # Let mentionee be DummyMentionee.create
9
+ ###
10
+ let(:mentionee) { DummyMentionee.create }
11
+
12
+ ###
13
+ # Let mentioner be DummyMentioner.create
14
+ ###
15
+ let(:mentioner) { DummyMentioner.create }
16
+
17
+ ###
18
+ # Describes associations
19
+ ###
20
+ describe "associations" do
21
+ ###
22
+ # Should have many mentionees
23
+ ###
24
+ it "should have many mentionees" do
25
+ should have_many(:mentionees)
26
+ end
27
+ end
28
+
29
+ ###
30
+ # Describes class methods
31
+ ###
32
+ describe "class methods" do
33
+ ###
34
+ # Should be a mentioner
35
+ ###
36
+ it "should be a mentioner" do
37
+ expect(mentioner.is_mentioner?).to equal(true)
38
+ end
39
+
40
+ ###
41
+ # Should mention a mentionee
42
+ ###
43
+ it "Should mention a mentionee" do
44
+ expect(MentionSystem::Mention).to receive(:mention).with(mentioner, mentionee) { true }
45
+
46
+ expect(mentioner.mention(mentionee)).to equal(true)
47
+ end
48
+
49
+ ###
50
+ # Should unmention a mentionee
51
+ ###
52
+ it "Should unmention a mentionee" do
53
+ expect(MentionSystem::Mention).to receive(:unmention).with(mentioner, mentionee) { true }
54
+
55
+ expect(mentioner.unmention(mentionee)).to equal(true)
56
+ end
57
+
58
+ ###
59
+ # Should toggle mention a mentionee
60
+ ###
61
+ it "Should toggle mention a mentionee" do
62
+ expect(MentionSystem::Mention).to receive(:toggle_mention).with(mentioner, mentionee) { true }
63
+
64
+ expect(mentioner.toggle_mention(mentionee)).to equal(true)
65
+ end
66
+
67
+ ###
68
+ # Should mention a mentionee
69
+ ###
70
+ it "should specify if mentions a mentionee" do
71
+ expect(MentionSystem::Mention).to receive(:mentions?).with(mentioner, mentionee) { true }
72
+
73
+ expect(mentioner.mentions?(mentionee)).to equal(true)
74
+ end
75
+
76
+ ###
77
+ # Should scope mentionees filtered by mentionee type
78
+ ###
79
+ it "should scope mentionees filtered by mentionee type" do
80
+ scope = MentionSystem::Mention.scope_by_mentioner(mentioner).scope_by_mentionee_type(DummyMentionee)
81
+
82
+ expect(mentioner.mentionees_by(DummyMentionee)).to eq(scope)
83
+ end
84
+ end
85
+ end
86
+
87
+ ###
88
+ # Describes DummyMentioner
89
+ ###
90
+ describe DummyMentioner do
91
+ ###
92
+ # It behaves like MentionSystem::Mentioner
93
+ ###
94
+ it_behaves_like MentionSystem::Mentioner
95
+ end
96
+
@@ -0,0 +1,116 @@
1
+ require 'support/active_record'
2
+ require 'support/shoulda_matchers'
3
+ require 'mention_system'
4
+
5
+ # This file was generated by the `rspec --init` command. Conventionally, all
6
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
8
+ # file to always be loaded, without a need to explicitly require it in any files.
9
+ #
10
+ # Given that it is always loaded, you are encouraged to keep this file as
11
+ # light-weight as possible. Requiring heavyweight dependencies from this file
12
+ # will add to the boot time of your test suite on EVERY test run, even for an
13
+ # individual file that may not need all of that loaded. Instead, consider making
14
+ # a separate helper file that requires the additional dependencies and performs
15
+ # the additional setup, and require it from the spec files that actually need it.
16
+ #
17
+ # The `.rspec` file also contains a few flags that are not defaults but that
18
+ # users commonly want.
19
+ #
20
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # The settings below are suggested to provide a good initial experience
46
+ # with RSpec, but feel free to customize to your heart's content.
47
+ =begin
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
56
+ # For more details, see:
57
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
58
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
59
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
60
+ config.disable_monkey_patching!
61
+
62
+ # This setting enables warnings. It's recommended, but in some cases may
63
+ # be too noisy due to issues in dependencies.
64
+ config.warnings = true
65
+
66
+ # Many RSpec users commonly either run the entire suite or an individual
67
+ # file, and it's useful to allow more verbose output when running an
68
+ # individual spec file.
69
+ if config.files_to_run.one?
70
+ # Use the documentation formatter for detailed output,
71
+ # unless a formatter has already been configured
72
+ # (e.g. via a command-line flag).
73
+ config.default_formatter = 'doc'
74
+ end
75
+
76
+ # Print the 10 slowest examples and example groups at the
77
+ # end of the spec run, to help surface which specs are running
78
+ # particularly slow.
79
+ config.profile_examples = 10
80
+
81
+ # Run specs in random order to surface order dependencies. If you find an
82
+ # order dependency and want to debug it, you can fix the order by providing
83
+ # the seed, which is printed after each run.
84
+ # --seed 1234
85
+ config.order = :random
86
+
87
+ # Seed global randomization in this process using the `--seed` CLI option.
88
+ # Setting this allows you to use `--seed` to deterministically reproduce
89
+ # test failures related to randomization by passing the same `--seed` value
90
+ # as the one that triggered the failure.
91
+ Kernel.srand config.seed
92
+ =end
93
+ end
94
+
95
+ ###
96
+ # DummyMentionee class
97
+ #
98
+ # This class defines the dummy mentionee model in mention system
99
+ ###
100
+ class DummyMentionee < ActiveRecord::Base
101
+ ###
102
+ # Acts as mentionee
103
+ act_as_mentionee
104
+ end
105
+
106
+ ###
107
+ # DummyMentioner class
108
+ #
109
+ # This class defines the dummy mentioner model in mention system
110
+ ###
111
+ class DummyMentioner < ActiveRecord::Base
112
+ ###
113
+ # Acts as mentioner
114
+ act_as_mentioner
115
+ end
116
+
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ require 'active_record'
2
+
3
+ ###
4
+ # Active record database configuration
5
+ ###
6
+ ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
7
+
8
+ ###
9
+ # Active record migrator configuration
10
+ ###
11
+ ActiveRecord::Migrator.up 'spec/db/migrate'
12
+
@@ -0,0 +1,2 @@
1
+ require 'shoulda/matchers'
2
+
metadata ADDED
@@ -0,0 +1,240 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mention_system
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Pablo Martin Viva
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: appraisal
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.7'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.7'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '10.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '10.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.1'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.1'
89
+ - !ruby/object:Gem::Dependency
90
+ name: shoulda-matchers
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.7'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.7'
103
+ - !ruby/object:Gem::Dependency
104
+ name: sqlite3
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.3'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.3'
117
+ description: An active record mention system developed using ruby on rails 4.1 applying
118
+ domain driven design and test driven development principles.
119
+ email:
120
+ - pmviva@gmail.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - ".empty"
126
+ - ".gitignore"
127
+ - ".keep"
128
+ - ".rspec"
129
+ - ".ruby-gemset"
130
+ - ".ruby-version"
131
+ - ".travis.yml"
132
+ - Appraisals
133
+ - Gemfile
134
+ - LICENSE.txt
135
+ - README.md
136
+ - Rakefile
137
+ - gemfiles/.empty
138
+ - gemfiles/.gitignore
139
+ - gemfiles/.keep
140
+ - gemfiles/rails4.1.gemfile
141
+ - gemfiles/rails4.2.gemfile
142
+ - lib/.empty
143
+ - lib/.gitignore
144
+ - lib/.keep
145
+ - lib/generators/.empty
146
+ - lib/generators/.gitignore
147
+ - lib/generators/.keep
148
+ - lib/generators/mention_system/.empty
149
+ - lib/generators/mention_system/.gitignore
150
+ - lib/generators/mention_system/.keep
151
+ - lib/generators/mention_system/mention_system_generator.rb
152
+ - lib/generators/mention_system/templates/.empty
153
+ - lib/generators/mention_system/templates/.gitignore
154
+ - lib/generators/mention_system/templates/.keep
155
+ - lib/generators/mention_system/templates/migration.rb
156
+ - lib/mention_system.rb
157
+ - lib/mention_system/.empty
158
+ - lib/mention_system/.gitignore
159
+ - lib/mention_system/.keep
160
+ - lib/mention_system/mention.rb
161
+ - lib/mention_system/mention_processor.rb
162
+ - lib/mention_system/mentionee.rb
163
+ - lib/mention_system/mentioner.rb
164
+ - lib/mention_system/version.rb
165
+ - mention_system.gemspec
166
+ - spec/.empty
167
+ - spec/.gitignore
168
+ - spec/.keep
169
+ - spec/db/.empty
170
+ - spec/db/.gitignore
171
+ - spec/db/.keep
172
+ - spec/db/migrate/.empty
173
+ - spec/db/migrate/.gitignore
174
+ - spec/db/migrate/.keep
175
+ - spec/db/migrate/20140926000000_create_mentions.rb
176
+ - spec/db/migrate/20140926000005_create_dummy_mentioners.rb
177
+ - spec/db/migrate/20140926000010_create_dummy_mentionees.rb
178
+ - spec/mention_system/.empty
179
+ - spec/mention_system/.gitignore
180
+ - spec/mention_system/.keep
181
+ - spec/mention_system/mention_processor_spec.rb
182
+ - spec/mention_system/mention_spec.rb
183
+ - spec/mention_system/mentionee_spec.rb
184
+ - spec/mention_system/mentioner_spec.rb
185
+ - spec/spec_helper.rb
186
+ - spec/support/.empty
187
+ - spec/support/.gitignore
188
+ - spec/support/.keep
189
+ - spec/support/active_record.rb
190
+ - spec/support/shoulda_matchers.rb
191
+ homepage: http://github.com/pmviva/mention_system
192
+ licenses:
193
+ - MIT
194
+ metadata: {}
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: 2.0.0
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 2.4.6
212
+ signing_key:
213
+ specification_version: 4
214
+ summary: An active record like system.
215
+ test_files:
216
+ - spec/.empty
217
+ - spec/.gitignore
218
+ - spec/.keep
219
+ - spec/db/.empty
220
+ - spec/db/.gitignore
221
+ - spec/db/.keep
222
+ - spec/db/migrate/.empty
223
+ - spec/db/migrate/.gitignore
224
+ - spec/db/migrate/.keep
225
+ - spec/db/migrate/20140926000000_create_mentions.rb
226
+ - spec/db/migrate/20140926000005_create_dummy_mentioners.rb
227
+ - spec/db/migrate/20140926000010_create_dummy_mentionees.rb
228
+ - spec/mention_system/.empty
229
+ - spec/mention_system/.gitignore
230
+ - spec/mention_system/.keep
231
+ - spec/mention_system/mention_processor_spec.rb
232
+ - spec/mention_system/mention_spec.rb
233
+ - spec/mention_system/mentionee_spec.rb
234
+ - spec/mention_system/mentioner_spec.rb
235
+ - spec/spec_helper.rb
236
+ - spec/support/.empty
237
+ - spec/support/.gitignore
238
+ - spec/support/.keep
239
+ - spec/support/active_record.rb
240
+ - spec/support/shoulda_matchers.rb