intercom-rails 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.mdown
CHANGED
@@ -170,6 +170,7 @@ Any custom data defined in `config/initializers/intercom.rb` will also be sent.
|
|
170
170
|
## Contributors
|
171
171
|
|
172
172
|
- Dr Nic Williams (@drnic) - provided a rails generator for adding the Intercom javascript tag into your layout.
|
173
|
+
- Alexander Chaychuk (@sashich) - fixed bug in user detection when users not persisted (e.g. new session view with devise).
|
173
174
|
|
174
175
|
## License
|
175
176
|
|
@@ -35,7 +35,7 @@ module IntercomRails
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def valid?
|
38
|
-
return false if user.blank?
|
38
|
+
return false if user.blank? || user.respond_to?(:new_record?) && user.new_record?
|
39
39
|
return true if user.respond_to?(:id) && user.id.present?
|
40
40
|
return true if user.respond_to?(:email) && user.email.present?
|
41
41
|
false
|
@@ -74,6 +74,14 @@ class UserTest < MiniTest::Unit::TestCase
|
|
74
74
|
assert_equal true, User.new(DUMMY_USER).valid?
|
75
75
|
end
|
76
76
|
|
77
|
+
def test_not_valid_if_new_record?
|
78
|
+
new_record_user = dummy_user(:email => 'not-saved@intercom.io', :name => 'New Record')
|
79
|
+
def new_record_user.new_record?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
assert_equal false, User.new(new_record_user).valid?
|
83
|
+
end
|
84
|
+
|
77
85
|
def test_includes_custom_data_from_intercom_custom_data
|
78
86
|
object_with_intercom_custom_data = Object.new
|
79
87
|
object_with_intercom_custom_data.instance_eval do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-11-
|
14
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -179,18 +179,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- - ! '>='
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
|
-
segments:
|
183
|
-
- 0
|
184
|
-
hash: -3480669061587157733
|
185
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
183
|
none: false
|
187
184
|
requirements:
|
188
185
|
- - ! '>='
|
189
186
|
- !ruby/object:Gem::Version
|
190
187
|
version: '0'
|
191
|
-
segments:
|
192
|
-
- 0
|
193
|
-
hash: -3480669061587157733
|
194
188
|
requirements: []
|
195
189
|
rubyforge_project: intercom-rails
|
196
190
|
rubygems_version: 1.8.23
|