-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added remaining unit tests for #2933 * Minor change * Indentation changed * Added tests and moved emails to fixtures * Added tests and moved emails to fixtures
- Loading branch information
1 parent
828db88
commit 3c79545
Showing
12 changed files
with
82 additions
and
8 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
test/fixtures/incoming_test_emails/gmail/filtered_comment.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This is another reply by email comment | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
On Tue, Jul 3, 2018 at 11:17 PM Naman Gupta \<[01namangupta@gmail.com](mailto:01namangupta@gmail.com)\> wrote: | ||
|
||
> This is reply by comment | ||
> | ||
> | ||
> On Tue, Jul 3, 2018 at 11:13 PM Rails Projects \<[railsprojects2018@gmail.com](mailto:railsprojects2018@gmail.com)\> wrote: | ||
> | ||
> > This is a comment sent to the user by publiclab. | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'test_helper' | ||
|
||
class ApplicationHelperTest < ActionView::TestCase | ||
|
||
test 'should give filtered comment body' do | ||
f = File.open('test/fixtures/incoming_test_emails/gmail/final_parsed_comment.txt', 'r') | ||
filtered_body = filtered_comment_body(f.read) | ||
f.close() | ||
f = File.open('test/fixtures/incoming_test_emails/gmail/filtered_comment.txt', 'r') | ||
assert_equal filtered_body, f.read | ||
f.close() | ||
end | ||
|
||
test 'should give trimmed content of comment' do | ||
f = File.open('test/fixtures/incoming_test_emails/gmail/final_parsed_comment.txt', 'r') | ||
trimmed_content = trimmed_body(f.read) | ||
f.close() | ||
f = File.open('test/fixtures/incoming_test_emails/gmail/trimmed_content.txt', 'r') | ||
assert_equal trimmed_content, f.read | ||
f.close() | ||
end | ||
|
||
test 'should return true if contain trimmed content' do | ||
f = File.open('test/fixtures/incoming_test_emails/gmail/final_parsed_comment.txt', 'r') | ||
contain_trimmed_body = contain_trimmed_body?(f.read) | ||
assert_equal contain_trimmed_body, true | ||
f.close() | ||
end | ||
|
||
test 'should return false if there is no trimmed content' do | ||
contain_trimmed_body = contain_trimmed_body?("Without trimmed content") | ||
assert_equal contain_trimmed_body, false | ||
end | ||
|
||
end |