acts-as-messageable 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +1,39 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  class CustomMessage < ActsAsMessageable::Message
4
- def custom_method;end
4
+ def custom_method; end
5
5
  end
6
6
 
7
- describe "custom class" do
8
- let(:alice) { User.find_by_email("alice@example.com") }
9
- let(:bob) { User.find_by_email("bob@example.com") }
7
+ describe 'custom class' do
8
+ let(:alice) { User.find_by_email('alice@example.com') }
9
+ let(:bob) { User.find_by_email('bob@example.com') }
10
10
 
11
11
  before do
12
- User.acts_as_messageable :class_name => "CustomMessage", :table_name => "custom_messages"
13
- @message = alice.send_message(bob, :topic => "Helou bob!", :body => "What's up?")
12
+ User.acts_as_messageable class_name: 'CustomMessage', table_name: 'custom_messages'
13
+ @message = alice.send_message(bob, topic: 'Helou bob!', body: "What's up?")
14
14
  end
15
15
 
16
16
  after { User.acts_as_messageable }
17
17
 
18
- it "returns messages from alice with filter" do
19
- bob.messages.are_from(alice).should include(@message)
18
+ it 'returns messages from alice with filter' do
19
+ expect(bob.messages.are_from(alice)).to include(@message)
20
20
  end
21
21
 
22
- it "uses new table name" do
23
- CustomMessage.are_from(alice).should include(@message)
22
+ it 'uses new table name' do
23
+ expect(CustomMessage.are_from(alice)).to include(@message)
24
24
  end
25
25
 
26
- it "message should have CustomMessage class" do
27
- @message.class.should == CustomMessage
26
+ it 'message should have CustomMessage class' do
27
+ expect(@message.class).to eq(CustomMessage)
28
28
  end
29
29
 
30
- it "responds to custom_method" do
31
- @message.should respond_to(:custom_method)
30
+ it 'responds to custom_method' do
31
+ expect(@message).to respond_to(:custom_method)
32
32
  end
33
33
 
34
- it "return proper class with ancestry methods" do
35
- @reply_message = @message.reply(:topic => "Re: Helou bob!", :body => "Fine!")
36
- @reply_message.root.should == @message
37
- @reply_message.root.class.should == CustomMessage
34
+ it 'return proper class with ancestry methods' do
35
+ @reply_message = @message.reply(topic: 'Re: Helou bob!', body: 'Fine!')
36
+ expect(@reply_message.root).to eq(@message)
37
+ expect(@reply_message.root.class).to eq(CustomMessage)
38
38
  end
39
39
  end
40
-
@@ -1,50 +1,50 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "custom require" do
3
+ describe 'custom require' do
4
4
  before(:each) do
5
5
  # Use clean version of Message class
6
- ActsAsMessageable.instance_eval { remove_const "Message" }
7
- load "acts-as-messageable/message.rb"
6
+ ActsAsMessageable.instance_eval { remove_const 'Message' }
7
+ load 'acts-as-messageable/message.rb'
8
8
  end
9
9
 
10
- it "should work with non-array require" do
11
- User.acts_as_messageable :required => :body
12
- ActsAsMessageable::Message.required.should == ([:body])
10
+ it 'should work with non-array require' do
11
+ User.acts_as_messageable required: :body
12
+ expect(ActsAsMessageable::Message.required).to eq([:body])
13
13
  end
14
14
 
15
- it "should work with array require" do
16
- User.acts_as_messageable :required => [:body, :topic]
17
- ActsAsMessageable::Message.required.should == ([:body, :topic])
15
+ it 'should work with array require' do
16
+ User.acts_as_messageable required: %i[body topic]
17
+ expect(ActsAsMessageable::Message.required).to eq(%i[body topic])
18
18
  end
19
19
 
20
- context "only body" do
20
+ context 'only body' do
21
21
  before(:each) do
22
- User.acts_as_messageable :required => :body
22
+ User.acts_as_messageable required: :body
23
23
  end
24
24
 
25
- it "alice should able to send message to bob only with body" do
26
- @alice.send_message(@bob, "Hello bob!")
27
- @alice.messages.first.body.should == "Hello bob!"
28
- @bob.received_messages.first.body.should == "Hello bob!"
25
+ it 'alice should able to send message to bob only with body' do
26
+ @alice.send_message(@bob, 'Hello bob!')
27
+ expect(@alice.messages.first.body).to eq('Hello bob!')
28
+ expect(@bob.received_messages.first.body).to eq('Hello bob!')
29
29
  end
30
30
 
31
- it "alice should able to send message to bob with hash" do
32
- @alice.send_message(@bob, :body => "Hi Bob! I'm hash master")
33
- @alice.messages.first.body.should == "Hi Bob! I'm hash master"
31
+ it 'alice should able to send message to bob with hash' do
32
+ @alice.send_message(@bob, body: "Hi Bob! I'm hash master")
33
+ expect(@alice.messages.first.body).to eq("Hi Bob! I'm hash master")
34
34
  end
35
35
 
36
- it "alice send message to bob with body and bob reply to alice" do
37
- @alice.send_message(@bob, "Hi Bob!")
36
+ it 'alice send message to bob with body and bob reply to alice' do
37
+ @alice.send_message(@bob, 'Hi Bob!')
38
38
  @message_from_alice = @bob.received_messages.first
39
- @message_from_alice.body.should == "Hi Bob!"
40
- @bob.reply_to(@message_from_alice, "Hi Alice!")
41
- @alice.received_messages.first.body.should == "Hi Alice!"
39
+ expect(@message_from_alice.body).to eq('Hi Bob!')
40
+ @bob.reply_to(@message_from_alice, 'Hi Alice!')
41
+ expect(@alice.received_messages.first.body).to eq('Hi Alice!')
42
42
  end
43
43
 
44
- it "alice send message to bob and bob reply with hash" do
45
- @message_from_alice = @alice.send_message(@bob, "Hi Bob!")
46
- @bob.reply_to(@message_from_alice, :body => "Hi Alice!")
47
- @alice.received_messages.first.body.should == "Hi Alice!"
44
+ it 'alice send message to bob and bob reply with hash' do
45
+ @message_from_alice = @alice.send_message(@bob, 'Hi Bob!')
46
+ @bob.reply_to(@message_from_alice, body: 'Hi Alice!')
47
+ expect(@alice.received_messages.first.body).to eq('Hi Alice!')
48
48
  end
49
49
  end
50
50
  end
@@ -1,28 +1,26 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
- describe "group messages" do
4
- let(:alice) { User.find_by_email("alice@example.com") }
5
- let(:bob) { User.find_by_email("bob@example.com") }
6
- let(:pat) { User.find_by_email("pat@example.com") }
3
+ describe 'group messages' do
4
+ let(:alice) { User.find_by_email('alice@example.com') }
5
+ let(:bob) { User.find_by_email('bob@example.com') }
6
+ let(:pat) { User.find_by_email('pat@example.com') }
7
7
 
8
8
  before do
9
- User.acts_as_messageable :group_messages => true
10
- @message = alice.send_message(bob, :topic => "Helou bob!", :body => "What's up?")
9
+ User.acts_as_messageable group_messages: true
10
+ @message = alice.send_message(bob, topic: 'Helou bob!', body: "What's up?")
11
11
  end
12
12
 
13
- it "joins to conversation" do
14
- @reply_message = pat.reply_to(@message, "Hi there!", "I would like to join to this conversation!")
15
- @sec_reply_message = bob.reply_to(@message, "Hi!", "Fine!")
16
- @third_reply_message = alice.reply_to(@reply_message, "hi!", "no problem")
17
- @message.conversation.should include(@sec_reply_message, @third_reply_message, @reply_message, @message)
13
+ it 'joins to conversation' do
14
+ @reply_message = pat.reply_to(@message, 'Hi there!', 'I would like to join to this conversation!')
15
+ @sec_reply_message = bob.reply_to(@message, 'Hi!', 'Fine!')
16
+ @third_reply_message = alice.reply_to(@reply_message, 'hi!', 'no problem')
17
+ expect(@message.conversation).to include(@sec_reply_message, @third_reply_message, @reply_message, @message)
18
18
  end
19
19
 
20
- it "alice,bob and pat should be involve into conversation" do
21
- @reply_message = pat.reply_to(@message, "Hi there!", "I would like to join to this conversation!")
22
- @sec_reply_message = bob.reply_to(@message, "Hi!", "Fine!")
23
- @third_reply_message = alice.reply_to(@reply_message, "hi!", "no problem")
24
- @message.people.should == [alice, bob, pat]
20
+ it 'alice,bob and pat should be involve into conversation' do
21
+ @reply_message = pat.reply_to(@message, 'Hi there!', 'I would like to join to this conversation!')
22
+ @sec_reply_message = bob.reply_to(@message, 'Hi!', 'Fine!')
23
+ @third_reply_message = alice.reply_to(@reply_message, 'hi!', 'no problem')
24
+ expect(@message.people).to eq([alice, bob, pat])
25
25
  end
26
-
27
26
  end
28
-
@@ -13,20 +13,20 @@ Bundler.require(:default)
13
13
 
14
14
  require 'acts-as-messageable'
15
15
 
16
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
16
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
17
17
 
18
18
  ActiveRecord::Migration.verbose = false
19
19
 
20
20
  RSpec.configure do |config|
21
21
  config.before(:all) do
22
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
22
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
23
23
  create_database
24
24
 
25
- @alice = User.create :email => "alice@example.com"
26
- @bob = User.create :email => "bob@example.com"
27
- @pat = User.create :email => "pat@example.com"
28
- @admin = Admin.create :email => "admin@example.com"
29
- @men = Men.create :email => "men@example.com"
25
+ @alice = User.create email: 'alice@example.com'
26
+ @bob = User.create email: 'bob@example.com'
27
+ @pat = User.create email: 'pat@example.com'
28
+ @admin = Admin.create email: 'admin@example.com'
29
+ @men = Men.create email: 'men@example.com'
30
30
  end
31
31
 
32
32
  config.after(:all) do
@@ -39,17 +39,17 @@ RSpec.configure do |config|
39
39
  end
40
40
 
41
41
  def create_database
42
- ActiveRecord::Schema.define(:version => 1) do
42
+ ActiveRecord::Schema.define(version: 1) do
43
43
  create_table :messages do |t|
44
44
  t.string :topic
45
45
  t.text :body
46
- t.references :received_messageable, :polymorphic => true
47
- t.references :sent_messageable, :polymorphic => true
48
- t.boolean :opened, :default => false
49
- t.boolean :recipient_delete, :default => false
50
- t.boolean :sender_delete, :default => false
51
- t.boolean :recipient_permanent_delete, :default => false
52
- t.boolean :sender_permanent_delete, :default => false
46
+ t.references :received_messageable, polymorphic: true, index: false
47
+ t.references :sent_messageable, polymorphic: true, index: false
48
+ t.boolean :opened, default: false
49
+ t.boolean :recipient_delete, default: false
50
+ t.boolean :sender_delete, default: false
51
+ t.boolean :recipient_permanent_delete, default: false
52
+ t.boolean :sender_permanent_delete, default: false
53
53
  t.string :ancestry
54
54
  t.timestamps
55
55
  end
@@ -57,13 +57,13 @@ def create_database
57
57
  create_table :custom_messages do |t|
58
58
  t.string :topic
59
59
  t.text :body
60
- t.references :received_messageable, :polymorphic => true
61
- t.references :sent_messageable, :polymorphic => true
62
- t.boolean :opened, :default => false
63
- t.boolean :recipient_delete, :default => false
64
- t.boolean :sender_delete, :default => false
65
- t.boolean :recipient_permanent_delete, :default => false
66
- t.boolean :sender_permanent_delete, :default => false
60
+ t.references :received_messageable, polymorphic: true, index: false
61
+ t.references :sent_messageable, polymorphic: true, index: false
62
+ t.boolean :opened, default: false
63
+ t.boolean :recipient_delete, default: false
64
+ t.boolean :sender_delete, default: false
65
+ t.boolean :recipient_permanent_delete, default: false
66
+ t.boolean :sender_permanent_delete, default: false
67
67
  t.string :ancestry
68
68
  t.timestamps
69
69
  end
@@ -1,3 +1,3 @@
1
- class Admin < ActiveRecord::Base
2
- acts_as_messageable
3
- end
1
+ class Admin < ActiveRecord::Base
2
+ acts_as_messageable
3
+ end
@@ -1,3 +1,3 @@
1
- def send_message(from=@bob, to=@alice, topic="Topic", body="Body")
1
+ def send_message(from = @bob, to = @alice, topic = 'Topic', body = 'Body')
2
2
  from.send_message(to, topic, body)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts-as-messageable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Nielacny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-10 00:00:00.000000000 Z
11
+ date: 2019-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -67,35 +67,35 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: appraisal
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: jeweler
84
+ name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.8.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.8.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: sqlite3
98
+ name: jeweler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: coveralls
112
+ name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: appraisal
126
+ name: sqlite3
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -154,12 +154,14 @@ files:
154
154
  - Rakefile
155
155
  - VERSION
156
156
  - acts-as-messageable.gemspec
157
- - gemfiles/rails_3.0.gemfile
158
- - gemfiles/rails_3.1.gemfile
159
157
  - gemfiles/rails_3.2.gemfile
160
- - gemfiles/rails_4.0.gemfile
161
- - gemfiles/rails_4.1.gemfile
162
- - gemfiles/rails_4.1_ProtectedAttributes.gemfile
158
+ - gemfiles/rails_3.2.gemfile.lock
159
+ - gemfiles/rails_4.2.11.gemfile
160
+ - gemfiles/rails_4.2.11.gemfile.lock
161
+ - gemfiles/rails_5.2.gemfile
162
+ - gemfiles/rails_5.2.gemfile.lock
163
+ - gemfiles/rails_6.0.gemfile
164
+ - gemfiles/rails_6.0.gemfile.lock
163
165
  - lib/acts-as-messageable.rb
164
166
  - lib/acts-as-messageable/message.rb
165
167
  - lib/acts-as-messageable/model.rb
@@ -198,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
200
  version: '0'
199
201
  requirements: []
200
202
  rubyforge_project:
201
- rubygems_version: 2.2.2
203
+ rubygems_version: 2.7.6
202
204
  signing_key:
203
205
  specification_version: 4
204
206
  summary: Make user messageable!;-)
@@ -1,16 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activerecord", "~> 3.0.0"
6
- gem "activesupport", "~> 3.0.0"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 3.0.0"
9
-
10
- group :development do
11
- gem "rspec", "~> 2.0"
12
- gem "jeweler", "~> 1.8.0"
13
- gem "sqlite3"
14
- gem "coveralls", :require => false
15
- gem "appraisal"
16
- end
@@ -1,16 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activerecord", "~> 3.1.0"
6
- gem "activesupport", "~> 3.1.0"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 3.1.0"
9
-
10
- group :development do
11
- gem "rspec", "~> 2.0"
12
- gem "jeweler", "~> 1.8.0"
13
- gem "sqlite3"
14
- gem "coveralls", :require => false
15
- gem "appraisal"
16
- end
@@ -1,16 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.0.0"
6
- gem "activesupport", "~> 4.0.0"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 4.0.0"
9
-
10
- group :development do
11
- gem "rspec", "~> 2.0"
12
- gem "jeweler", "~> 1.8.0"
13
- gem "sqlite3"
14
- gem "coveralls", :require => false
15
- gem "appraisal"
16
- end
@@ -1,16 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.1.0"
6
- gem "activesupport", "~> 4.1.0"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 4.1.0"
9
-
10
- group :development do
11
- gem "rspec", "~> 2.0"
12
- gem "jeweler", "~> 1.8.0"
13
- gem "sqlite3"
14
- gem "coveralls", :require => false
15
- gem "appraisal"
16
- end