proclaim 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +5 -38
- data/app/assets/config/proclaim_manifest.js +2 -0
- data/app/assets/images/{ajax_loader.gif → proclaim/ajax_loader.gif} +0 -0
- data/app/assets/javascripts/proclaim.js +7 -7
- data/app/assets/javascripts/proclaim/{comments_handler.js.coffee → comments_handler.coffee} +16 -10
- data/app/assets/javascripts/proclaim/editor.coffee +55 -0
- data/app/assets/stylesheets/{proclaim.css.scss → proclaim.scss} +7 -8
- data/app/assets/stylesheets/proclaim/{comments.css.scss → comments.scss} +0 -0
- data/app/assets/stylesheets/proclaim/{posts.css.scss → posts.scss} +60 -25
- data/app/assets/stylesheets/proclaim/{subscriptions.css.scss → subscriptions.scss} +0 -0
- data/app/controllers/proclaim/application_controller.rb +60 -56
- data/app/controllers/proclaim/comments_controller.rb +13 -42
- data/app/controllers/proclaim/posts_controller.rb +25 -57
- data/app/controllers/proclaim/subscriptions_controller.rb +3 -3
- data/app/jobs/proclaim/application_job.rb +4 -0
- data/app/mailers/proclaim/application_mailer.rb +5 -0
- data/app/mailers/proclaim/subscription_mailer.rb +19 -17
- data/app/models/proclaim/application_record.rb +5 -0
- data/app/models/proclaim/comment.rb +6 -1
- data/app/models/proclaim/post.rb +20 -28
- data/app/models/proclaim/subscription.rb +33 -11
- data/app/views/layouts/proclaim/subscription_mailer.html.erb +15 -36
- data/app/views/proclaim/comments/_comment.html.erb +7 -7
- data/app/views/proclaim/comments/_form.html.erb +7 -5
- data/app/views/proclaim/posts/_form.html.erb +34 -21
- data/app/views/proclaim/posts/show.html.erb +16 -3
- data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +2 -6
- data/config/initializers/friendly_id.rb +20 -1
- data/config/routes.rb +1 -5
- data/db/migrate/20141108222616_create_proclaim_posts.rb +8 -1
- data/db/migrate/20141114235359_create_proclaim_comments.rb +1 -1
- data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +1 -1
- data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +5 -4
- data/db/migrate/20150213015321_create_friendly_id_slugs.rb +1 -1
- data/lib/generators/proclaim/install_generator.rb +1 -1
- data/lib/generators/proclaim/templates/initialize_proclaim.rb +31 -29
- data/lib/generators/proclaim/views_generator.rb +1 -1
- data/lib/proclaim.rb +15 -15
- data/lib/proclaim/engine.rb +21 -19
- data/lib/proclaim/version.rb +1 -1
- data/vendor/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- data/vendor/assets/javascripts/contrib/auto-render.js +339 -0
- data/vendor/assets/javascripts/contrib/auto-render.min.js +1 -0
- data/vendor/assets/javascripts/contrib/auto-render.mjs +215 -0
- data/vendor/assets/javascripts/contrib/copy-tex.css +14 -0
- data/vendor/assets/javascripts/contrib/copy-tex.js +213 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.css +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.js +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.mjs +85 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.js +137 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.mjs +24 -0
- data/vendor/assets/javascripts/contrib/mhchem.js +3241 -0
- data/vendor/assets/javascripts/contrib/mhchem.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mhchem.mjs +3109 -0
- data/vendor/assets/javascripts/katex.js +16517 -0
- data/vendor/assets/javascripts/katex.min.js +1 -0
- data/vendor/assets/javascripts/katex.mjs +16122 -0
- data/vendor/assets/javascripts/quill.core.js +8522 -0
- data/vendor/assets/javascripts/quill.js +11489 -0
- data/vendor/assets/javascripts/quill.min.js +8 -0
- data/vendor/assets/javascripts/quill.min.js.map +1 -0
- data/vendor/assets/stylesheets/katex.css +1011 -0
- data/vendor/assets/stylesheets/katex.min.css +1 -0
- data/vendor/assets/stylesheets/quill.bubble.css +952 -0
- data/vendor/assets/stylesheets/quill.core.css +397 -0
- data/vendor/assets/stylesheets/quill.snow.css +945 -0
- metadata +169 -278
- data/CHANGELOG +0 -77
- data/Gemfile +0 -14
- data/VERSION +0 -1
- data/app/assets/javascripts/proclaim/editor.js.coffee +0 -52
- data/app/assets/javascripts/proclaim/images.js.coffee +0 -3
- data/app/assets/javascripts/proclaim/subscriptions.js.coffee +0 -3
- data/app/assets/stylesheets/proclaim/images.scss +0 -3
- data/app/controllers/proclaim/images_controller.rb +0 -67
- data/app/helpers/proclaim/comments_helper.rb +0 -4
- data/app/helpers/proclaim/images_helper.rb +0 -4
- data/app/helpers/proclaim/subscriptions_helper.rb +0 -4
- data/app/models/proclaim/image.rb +0 -19
- data/app/policies/proclaim/image_policy.rb +0 -29
- data/app/uploaders/proclaim/image_uploader.rb +0 -82
- data/db/migrate/20141222224905_create_proclaim_images.rb +0 -12
- data/db/migrate/20150123115226_add_name_to_subscriptions.rb +0 -7
- data/db/migrate/20150213015850_add_slug_to_posts.rb +0 -20
- data/proclaim.gemspec +0 -51
- data/test/controllers/proclaim/comments_controller_test.rb +0 -228
- data/test/controllers/proclaim/images_controller_test.rb +0 -166
- data/test/controllers/proclaim/posts_controller_test.rb +0 -465
- data/test/controllers/proclaim/subscriptions_controller_test.rb +0 -154
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -14
- data/test/dummy/app/assets/stylesheets/application.css +0 -16
- data/test/dummy/app/controllers/application_controller.rb +0 -15
- data/test/dummy/app/helpers/application_helper.rb +0 -28
- data/test/dummy/app/models/user.rb +0 -7
- data/test/dummy/app/views/layouts/application.html.erb +0 -16
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -24
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -45
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/config/environments/test.rb +0 -49
- data/test/dummy/config/initializers/assets.rb +0 -8
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -5
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20141117214323_create_users.rb +0 -10
- data/test/dummy/db/schema.rb +0 -91
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories/proclaim/comment.rb +0 -11
- data/test/factories/proclaim/image.rb +0 -6
- data/test/factories/proclaim/post.rb +0 -14
- data/test/factories/proclaim/subscription.rb +0 -14
- data/test/factories/user.rb +0 -6
- data/test/helpers/proclaim/comments_helper_test.rb +0 -6
- data/test/helpers/proclaim/posts_helper_test.rb +0 -6
- data/test/helpers/proclaim/subscriptions_helper_test.rb +0 -6
- data/test/integration/with_javascript/comment_test.rb +0 -391
- data/test/integration/with_javascript/post_form_test.rb +0 -225
- data/test/integration/with_javascript/post_show_test.rb +0 -47
- data/test/integration/with_javascript/post_subscription_test.rb +0 -302
- data/test/integration/without_javascript/blog_subscription_test.rb +0 -114
- data/test/integration/without_javascript/manage_subscriptions_test.rb +0 -37
- data/test/integration/without_javascript/post_test.rb +0 -234
- data/test/integration/without_javascript/subscription_email_test.rb +0 -95
- data/test/integration/without_javascript/unsubscribe_test.rb +0 -32
- data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +0 -22
- data/test/mailers/proclaim/subscription_mailer_test.rb +0 -91
- data/test/models/proclaim/comment_test.rb +0 -41
- data/test/models/proclaim/image_test.rb +0 -70
- data/test/models/proclaim/post_test.rb +0 -193
- data/test/models/proclaim/subscription_test.rb +0 -77
- data/test/policies/application_policy_test.rb +0 -87
- data/test/policies/proclaim/comment_policy_test.rb +0 -71
- data/test/policies/proclaim/image_policy_test.rb +0 -83
- data/test/policies/proclaim/post_policy_test.rb +0 -98
- data/test/policies/proclaim/subscription_policy_test.rb +0 -103
- data/test/proclaim_test.rb +0 -7
- data/test/support/images/test.jpg +0 -0
- data/test/support/pages/posts/edit_page.rb +0 -5
- data/test/support/pages/posts/show_page.rb +0 -47
- data/test/support/wait_for_ajax.rb +0 -11
- data/test/test_helper.rb +0 -71
- data/test/unit/proclaim/new_comment_callback_test.rb +0 -62
- data/test/unit/proclaim/new_subscription_callback_test.rb +0 -62
- data/test/unit/proclaim/post_published_callback_test.rb +0 -74
- data/vendor/assets/images/link.png +0 -0
- data/vendor/assets/images/remove.png +0 -0
- data/vendor/assets/images/resize-bigger.png +0 -0
- data/vendor/assets/images/resize-smaller.png +0 -0
- data/vendor/assets/images/unlink.png +0 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +0 -197
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +0 -572
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +0 -50
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +0 -496
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +0 -132
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +0 -1415
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css.scss +0 -55
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.css.scss +0 -277
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
factory :comment, class: Proclaim::Comment do
|
3
|
-
sequence(:author) {|n| "comment#{n} author"}
|
4
|
-
sequence(:body) {|n| "comment#{n} body"}
|
5
|
-
post
|
6
|
-
|
7
|
-
factory :published_comment do
|
8
|
-
association :post, factory: :published_post
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
factory :post, class: Proclaim::Post do
|
3
|
-
sequence(:title) {|n| "post#{n} title"}
|
4
|
-
sequence(:body) {|n| "post#{n} body"}
|
5
|
-
association :author, factory: :user
|
6
|
-
|
7
|
-
factory :published_post do
|
8
|
-
# Also called upon create
|
9
|
-
after(:build) do |post, evaluator|
|
10
|
-
post.publish
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
factory :subscription, class: Proclaim::Subscription do
|
3
|
-
sequence(:name) {|n| "name#{n}"}
|
4
|
-
sequence(:email) {|n| "email#{n}@example.com"}
|
5
|
-
|
6
|
-
factory :post_subscription do
|
7
|
-
post
|
8
|
-
end
|
9
|
-
|
10
|
-
factory :published_post_subscription do
|
11
|
-
association :post, factory: :published_post
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/test/factories/user.rb
DELETED
@@ -1,391 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class CommentTest < ActionDispatch::IntegrationTest
|
4
|
-
self.use_transactional_fixtures = false
|
5
|
-
|
6
|
-
setup do
|
7
|
-
ApplicationController.any_instance.stubs(:current_user).returns(nil)
|
8
|
-
ApplicationController.any_instance.stubs(:authenticate_user).returns(false)
|
9
|
-
|
10
|
-
DatabaseCleaner.strategy = :truncation
|
11
|
-
DatabaseCleaner.start
|
12
|
-
|
13
|
-
Capybara.current_driver = :selenium
|
14
|
-
|
15
|
-
@show_page = ShowPage.new
|
16
|
-
end
|
17
|
-
|
18
|
-
teardown do
|
19
|
-
DatabaseCleaner.clean
|
20
|
-
Capybara.use_default_driver
|
21
|
-
end
|
22
|
-
|
23
|
-
test "leave root comment" do
|
24
|
-
post = FactoryGirl.create(:published_post)
|
25
|
-
|
26
|
-
visit proclaim.post_path(post)
|
27
|
-
|
28
|
-
# Test leaving a root comment
|
29
|
-
within('#new_comment') do
|
30
|
-
fill_in 'Author', with: "Comment Author"
|
31
|
-
fill_in 'Body', with: "Comment Body"
|
32
|
-
fill_in 'What is', with: @show_page.antispam_solution
|
33
|
-
end
|
34
|
-
|
35
|
-
@show_page.new_comment_submit_button.click
|
36
|
-
|
37
|
-
assert page.has_no_css?('div.error')
|
38
|
-
assert page.has_text? "Comment Author"
|
39
|
-
assert page.has_text? "Comment Body"
|
40
|
-
end
|
41
|
-
|
42
|
-
test "leave two replies" do
|
43
|
-
comment = FactoryGirl.create(:published_comment)
|
44
|
-
post = comment.post
|
45
|
-
|
46
|
-
visit proclaim.post_path(post)
|
47
|
-
|
48
|
-
# Leave first reply
|
49
|
-
@show_page.comment_reply_link(comment).click
|
50
|
-
within("#reply_to_#{comment.id}_new_comment") do
|
51
|
-
fill_in 'Author', with: "Reply Author 1"
|
52
|
-
fill_in 'Body', with: "Reply Body 1"
|
53
|
-
fill_in 'What is', with: @show_page.antispam_solution(comment)
|
54
|
-
end
|
55
|
-
|
56
|
-
@show_page.new_comment_submit_button(comment).click
|
57
|
-
|
58
|
-
assert page.has_no_css?('div.error')
|
59
|
-
assert page.has_text? "Reply Author 1"
|
60
|
-
assert page.has_text? "Reply Body 1"
|
61
|
-
|
62
|
-
# Leave second reply
|
63
|
-
@show_page.comment_reply_link(comment).click
|
64
|
-
within("#reply_to_#{comment.id}_new_comment") do
|
65
|
-
fill_in 'Author', with: "Reply Author 2"
|
66
|
-
fill_in 'Body', with: "Reply Body 2"
|
67
|
-
fill_in 'What is', with: @show_page.antispam_solution(comment)
|
68
|
-
end
|
69
|
-
|
70
|
-
@show_page.new_comment_submit_button(comment).click
|
71
|
-
|
72
|
-
assert page.has_no_css?('div.error')
|
73
|
-
assert page.has_text? "Reply Author 2"
|
74
|
-
assert page.has_text? "Reply Body 2"
|
75
|
-
end
|
76
|
-
|
77
|
-
test "root comment should fail if spammy" do
|
78
|
-
post = FactoryGirl.create(:published_post)
|
79
|
-
|
80
|
-
visit proclaim.post_path(post)
|
81
|
-
|
82
|
-
# Test leaving a root comment
|
83
|
-
within('#new_comment') do
|
84
|
-
fill_in 'Author', with: "Comment Author"
|
85
|
-
fill_in 'Body', with: "Comment Body"
|
86
|
-
fill_in 'What is', with: "wrong answer"
|
87
|
-
end
|
88
|
-
|
89
|
-
@show_page.new_comment_submit_button.click
|
90
|
-
|
91
|
-
assert page.has_css?('div.error')
|
92
|
-
end
|
93
|
-
|
94
|
-
test "reply should fail if spammy" do
|
95
|
-
comment = FactoryGirl.create(:published_comment)
|
96
|
-
post = comment.post
|
97
|
-
|
98
|
-
visit proclaim.post_path(post)
|
99
|
-
|
100
|
-
@show_page.comment_reply_link(comment).click
|
101
|
-
within("#reply_to_#{comment.id}_new_comment") do
|
102
|
-
fill_in 'Author', with: "Reply Author 1"
|
103
|
-
fill_in 'Body', with: "Reply Body 1"
|
104
|
-
fill_in 'What is', with: "wrong answer"
|
105
|
-
end
|
106
|
-
|
107
|
-
@show_page.new_comment_submit_button(comment).click
|
108
|
-
|
109
|
-
assert page.has_css?('div.error')
|
110
|
-
end
|
111
|
-
|
112
|
-
test "reply forms should be exclusive" do
|
113
|
-
comment1 = FactoryGirl.create(:published_comment)
|
114
|
-
comment2 = FactoryGirl.create(:published_comment, post: comment1.post)
|
115
|
-
|
116
|
-
visit proclaim.post_path(comment1.post)
|
117
|
-
|
118
|
-
# Check that a form shows up to reply to comment1
|
119
|
-
@show_page.comment_reply_link(comment1).click
|
120
|
-
assert page.has_css? "form#reply_to_#{comment1.id}_new_comment"
|
121
|
-
|
122
|
-
# Now, without closing that form manually, assert that it is closed
|
123
|
-
# automatically when we try to reply to comment2
|
124
|
-
@show_page.comment_reply_link(comment2).click
|
125
|
-
assert page.has_css? "form#reply_to_#{comment2.id}_new_comment"
|
126
|
-
assert page.has_no_css?("form#reply_to_#{comment1.id}_new_comment"),
|
127
|
-
"The form from comment1 should be removed when replying to comment2!"
|
128
|
-
end
|
129
|
-
|
130
|
-
test "should not have option to edit if not logged in" do
|
131
|
-
comment = FactoryGirl.create(:published_comment)
|
132
|
-
|
133
|
-
visit proclaim.post_path(comment.post)
|
134
|
-
|
135
|
-
assert page.has_no_css?("#comment_#{comment.id} .edit"),
|
136
|
-
"A guest should not be given the option to edit a comment!"
|
137
|
-
end
|
138
|
-
|
139
|
-
test "edit root comment" do
|
140
|
-
user = FactoryGirl.create(:user)
|
141
|
-
sign_in user
|
142
|
-
|
143
|
-
comment = FactoryGirl.create(:published_comment)
|
144
|
-
|
145
|
-
visit proclaim.post_path(comment.post)
|
146
|
-
|
147
|
-
@show_page.comment_edit_link(comment).click
|
148
|
-
assert page.has_no_css?("p.comment_author", text: comment.author),
|
149
|
-
"The comment author should have been completely replaced by the edit form!"
|
150
|
-
assert page.has_no_css?("div.comment_body", text: comment.body),
|
151
|
-
"The comment body should have been completely replaced by the edit form!"
|
152
|
-
|
153
|
-
within("#edit_comment_#{comment.id}") do
|
154
|
-
fill_in 'Author', with: "Edit Author"
|
155
|
-
fill_in 'Body', with: "Edit Body"
|
156
|
-
end
|
157
|
-
@show_page.edit_comment_submit_button(comment).click
|
158
|
-
assert page.has_css? "p.comment_author", text: "Edit Author"
|
159
|
-
assert page.has_css? "div.comment_body", text: "Edit Body"
|
160
|
-
assert page.has_no_css?("p.comment_author", text: comment.author),
|
161
|
-
"The old comment author should be gone!"
|
162
|
-
assert page.has_no_css?("div.comment_body", text: comment.body),
|
163
|
-
"The old comment body should be gone!"
|
164
|
-
end
|
165
|
-
|
166
|
-
test "edit parent comment" do
|
167
|
-
user = FactoryGirl.create(:user)
|
168
|
-
sign_in user
|
169
|
-
|
170
|
-
parent = FactoryGirl.create(:published_comment)
|
171
|
-
child = FactoryGirl.create(:published_comment,
|
172
|
-
post: parent.post,
|
173
|
-
parent: parent)
|
174
|
-
|
175
|
-
visit proclaim.post_path(parent.post)
|
176
|
-
|
177
|
-
@show_page.comment_edit_link(parent).click
|
178
|
-
assert page.has_no_css?("p.comment_author", text: parent.author),
|
179
|
-
"The parent comment author should have been completely replaced by the edit form!"
|
180
|
-
assert page.has_no_css?("div.comment_body", text: parent.body),
|
181
|
-
"The parent comment body should have been completely replaced by the edit form!"
|
182
|
-
assert page.has_css?("p.comment_author", text: child.author),
|
183
|
-
"The child comment author should still be on the page!"
|
184
|
-
assert page.has_css?("div.comment_body", text: child.body),
|
185
|
-
"The child comment body should still be on the page!"
|
186
|
-
|
187
|
-
within("#edit_comment_#{parent.id}") do
|
188
|
-
fill_in 'Author', with: "Edit Author"
|
189
|
-
fill_in 'Body', with: "Edit Body"
|
190
|
-
end
|
191
|
-
@show_page.edit_comment_submit_button(parent).click
|
192
|
-
assert page.has_css?("p.comment_author", text: "Edit Author"),
|
193
|
-
"The parent comment author should now be edited!"
|
194
|
-
assert page.has_css?("div.comment_body", text: "Edit Body"),
|
195
|
-
"The parent comment body should now be edited!"
|
196
|
-
assert page.has_css?("p.comment_author", text: child.author),
|
197
|
-
"The child comment author should still be on the page!"
|
198
|
-
assert page.has_css?("div.comment_body", text: child.body),
|
199
|
-
"The child comment body should still be on the page!"
|
200
|
-
assert page.has_no_css?("p.comment_author", text: parent.author),
|
201
|
-
"The old parent comment author should be gone!"
|
202
|
-
assert page.has_no_css?("div.comment_body", text: parent.body),
|
203
|
-
"The old parent comment body should be gone!"
|
204
|
-
end
|
205
|
-
|
206
|
-
test "edit child comment" do
|
207
|
-
user = FactoryGirl.create(:user)
|
208
|
-
sign_in user
|
209
|
-
|
210
|
-
parent = FactoryGirl.create(:published_comment)
|
211
|
-
child = FactoryGirl.create(:published_comment,
|
212
|
-
post: parent.post,
|
213
|
-
parent: parent)
|
214
|
-
|
215
|
-
visit proclaim.post_path(parent.post)
|
216
|
-
|
217
|
-
@show_page.comment_edit_link(child).click
|
218
|
-
assert page.has_no_css?("p.comment_author", text: child.author),
|
219
|
-
"The child comment author should have been completely replaced by the edit form!"
|
220
|
-
assert page.has_no_css?("div.comment_body", text: child.body),
|
221
|
-
"The chid comment body should have been completely replaced by the edit form!"
|
222
|
-
assert page.has_css?("p.comment_author", text: parent.author),
|
223
|
-
"The parent comment author should still be on the page!"
|
224
|
-
assert page.has_css?("div.comment_body", text: parent.body),
|
225
|
-
"The parent comment body should still be on the page!"
|
226
|
-
|
227
|
-
within("#edit_comment_#{child.id}") do
|
228
|
-
fill_in 'Author', with: "Edit Author"
|
229
|
-
fill_in 'Body', with: "Edit Body"
|
230
|
-
end
|
231
|
-
@show_page.edit_comment_submit_button(child).click
|
232
|
-
assert page.has_css? "p.comment_author", text: 'Edit Author'
|
233
|
-
assert page.has_css? "div.comment_body", text: 'Edit Body'
|
234
|
-
assert page.has_css? "p.comment_author", text: parent.author
|
235
|
-
assert page.has_css? "div.comment_body", text: parent.body
|
236
|
-
|
237
|
-
assert page.has_no_css?("p.comment_author", text: child.author),
|
238
|
-
"The old child comment author should be gone!"
|
239
|
-
assert page.has_no_css?("div.comment_body", text: child.body),
|
240
|
-
"The old child comment body should be gone!"
|
241
|
-
end
|
242
|
-
|
243
|
-
test "edit should show error without author" do
|
244
|
-
user = FactoryGirl.create(:user)
|
245
|
-
sign_in user
|
246
|
-
|
247
|
-
comment = FactoryGirl.create(:published_comment)
|
248
|
-
|
249
|
-
visit proclaim.post_path(comment.post)
|
250
|
-
|
251
|
-
@show_page.comment_edit_link(comment).click
|
252
|
-
|
253
|
-
within("#edit_comment_#{comment.id}") do
|
254
|
-
fill_in 'Author', with: "" # An empty author should result in an error
|
255
|
-
end
|
256
|
-
|
257
|
-
@show_page.edit_comment_submit_button(comment).click
|
258
|
-
|
259
|
-
assert page.has_css?('div.error')
|
260
|
-
end
|
261
|
-
|
262
|
-
test "edit should show error without body" do
|
263
|
-
user = FactoryGirl.create(:user)
|
264
|
-
sign_in user
|
265
|
-
|
266
|
-
comment = FactoryGirl.create(:published_comment)
|
267
|
-
|
268
|
-
visit proclaim.post_path(comment.post)
|
269
|
-
|
270
|
-
@show_page.comment_edit_link(comment).click
|
271
|
-
|
272
|
-
within("#edit_comment_#{comment.id}") do
|
273
|
-
fill_in 'Body', with: "" # An empty body should result in an error
|
274
|
-
end
|
275
|
-
|
276
|
-
@show_page.edit_comment_submit_button(comment).click
|
277
|
-
|
278
|
-
assert page.has_css?('div.error')
|
279
|
-
end
|
280
|
-
|
281
|
-
test "should not have option to delete if not logged in" do
|
282
|
-
comment = FactoryGirl.create(:published_comment)
|
283
|
-
|
284
|
-
visit proclaim.post_path(comment.post)
|
285
|
-
|
286
|
-
assert page.has_no_css?("#comment_#{comment.id} .delete"),
|
287
|
-
"A guest should not be given the option to delete a comment!"
|
288
|
-
end
|
289
|
-
|
290
|
-
test "delete root comment" do
|
291
|
-
user = FactoryGirl.create(:user)
|
292
|
-
sign_in user
|
293
|
-
|
294
|
-
comment = FactoryGirl.create(:published_comment)
|
295
|
-
|
296
|
-
visit proclaim.post_path(comment.post)
|
297
|
-
|
298
|
-
assert page.has_text? comment.author
|
299
|
-
assert page.has_text? comment.body
|
300
|
-
|
301
|
-
current_count = Proclaim::Comment.count
|
302
|
-
|
303
|
-
@show_page.comment_delete_link(comment).click
|
304
|
-
page.accept_alert
|
305
|
-
|
306
|
-
assert page.has_no_text?(comment.author), "Comment author should be gone!"
|
307
|
-
assert page.has_no_text?(comment.body), "Comment body should be gone!"
|
308
|
-
|
309
|
-
assert(wait_until { Proclaim::Comment.count == current_count - 1 },
|
310
|
-
"Root comment should have been deleted!")
|
311
|
-
end
|
312
|
-
|
313
|
-
test "delete parent comment" do
|
314
|
-
user = FactoryGirl.create(:user)
|
315
|
-
sign_in user
|
316
|
-
|
317
|
-
parent = FactoryGirl.create(:published_comment)
|
318
|
-
child = FactoryGirl.create(:published_comment,
|
319
|
-
post: parent.post,
|
320
|
-
parent: parent)
|
321
|
-
|
322
|
-
visit proclaim.post_path(parent.post)
|
323
|
-
|
324
|
-
assert page.has_text? parent.author
|
325
|
-
assert page.has_text? parent.body
|
326
|
-
assert page.has_text? child.author
|
327
|
-
assert page.has_text? child.body
|
328
|
-
|
329
|
-
current_count = Proclaim::Comment.count
|
330
|
-
|
331
|
-
@show_page.comment_delete_link(parent).click
|
332
|
-
page.accept_alert
|
333
|
-
|
334
|
-
assert page.has_no_text?(parent.author), "Parent author should be gone!"
|
335
|
-
assert page.has_no_text?(parent.body), "Parent body should be gone!"
|
336
|
-
assert page.has_no_text?(child.author), "Child author should be gone!"
|
337
|
-
assert page.has_no_text?(child.body), "Child body should be gone!"
|
338
|
-
|
339
|
-
assert(wait_until { Proclaim::Comment.count == current_count - 2 },
|
340
|
-
"Both parent and child should have been deleted!")
|
341
|
-
end
|
342
|
-
|
343
|
-
test "delete child comment" do
|
344
|
-
user = FactoryGirl.create(:user)
|
345
|
-
sign_in user
|
346
|
-
|
347
|
-
parent = FactoryGirl.create(:published_comment)
|
348
|
-
child = FactoryGirl.create(:published_comment,
|
349
|
-
post: parent.post,
|
350
|
-
parent: parent)
|
351
|
-
|
352
|
-
visit proclaim.post_path(parent.post)
|
353
|
-
|
354
|
-
assert page.has_text? child.author
|
355
|
-
assert page.has_text? child.body
|
356
|
-
|
357
|
-
current_count = Proclaim::Comment.count
|
358
|
-
|
359
|
-
@show_page.comment_delete_link(child).click
|
360
|
-
page.accept_alert
|
361
|
-
|
362
|
-
assert page.has_no_text?(child.author), "Child author should be gone!"
|
363
|
-
assert page.has_no_text?(child.body), "Child body should be gone!"
|
364
|
-
assert page.has_text?(parent.author), "Parent author should not be gone!"
|
365
|
-
assert page.has_text?(parent.body), "Parent body should not be gone!"
|
366
|
-
|
367
|
-
assert(wait_until { Proclaim::Comment.count == current_count - 1 },
|
368
|
-
"Child comment should have been deleted!")
|
369
|
-
end
|
370
|
-
|
371
|
-
test "cancel button should remove errors" do
|
372
|
-
post = FactoryGirl.create(:published_post)
|
373
|
-
|
374
|
-
visit proclaim.post_path(post)
|
375
|
-
|
376
|
-
within('#new_comment') do
|
377
|
-
fill_in 'Author', with: "Comment Author"
|
378
|
-
# Make a mistake-- leave out the body
|
379
|
-
end
|
380
|
-
@show_page.new_comment_submit_button.click
|
381
|
-
|
382
|
-
# Errors should be on the page
|
383
|
-
assert page.has_css?('div.error')
|
384
|
-
|
385
|
-
# Now click cancel
|
386
|
-
@show_page.new_comment_cancel_button.click
|
387
|
-
|
388
|
-
# Now errors should be cleared
|
389
|
-
assert page.has_no_css?('div.error')
|
390
|
-
end
|
391
|
-
end
|