commontator 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/commontator/version.rb +1 -1
- data/lib/commontator/version.rb~ +1 -1
- data/spec/app/controllers/comments_controller_spec.rb~ +7 -0
- data/spec/app/controllers/commontator/application_controller_spec.rb~ +30 -0
- data/spec/app/controllers/commontator/comments_controller_spec.rb +473 -0
- data/spec/app/controllers/commontator/comments_controller_spec.rb~ +473 -0
- data/spec/app/controllers/commontator/subscriptions_controller_spec.rb +99 -0
- data/spec/app/controllers/commontator/subscriptions_controller_spec.rb~ +99 -0
- data/spec/app/controllers/commontator/threads_controller_spec.rb +121 -0
- data/spec/app/controllers/commontator/threads_controller_spec.rb~ +121 -0
- data/spec/app/controllers/threads_controller_spec.rb~ +12 -0
- data/spec/app/helpers/commontator/application_helper_spec.rb +7 -0
- data/spec/app/helpers/commontator/application_helper_spec.rb~ +7 -0
- data/spec/app/helpers/commontator/threads_helper_spec.rb +17 -0
- data/spec/app/helpers/commontator/threads_helper_spec.rb~ +17 -0
- data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb +38 -0
- data/spec/app/mailers/commontator/subscriptions_mailer_spec.rb~ +37 -0
- data/spec/app/models/commontator/comment_spec.rb +60 -0
- data/spec/app/models/commontator/comment_spec.rb~ +60 -0
- data/spec/app/models/commontator/subscription_spec.rb +28 -0
- data/spec/app/models/commontator/subscription_spec.rb~ +28 -0
- data/spec/app/models/commontator/thread_spec.rb +130 -0
- data/spec/app/models/commontator/thread_spec.rb~ +130 -0
- data/spec/dummy/Gemfile~ +3 -0
- data/spec/dummy/README.md +3 -0
- data/spec/dummy/README.md~ +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/application_controller.rb~ +7 -0
- data/spec/dummy/app/controllers/dummies_controller.rb~ +17 -0
- data/spec/dummy/app/controllers/dummy_models_controller.rb +29 -0
- data/spec/dummy/app/controllers/dummy_models_controller.rb~ +29 -0
- data/spec/dummy/app/helpers/application_helper.rb +15 -0
- data/spec/dummy/app/helpers/application_helper.rb~ +15 -0
- data/spec/dummy/app/models/dummy.rb~ +3 -0
- data/spec/dummy/app/models/dummy_model.rb +3 -0
- data/spec/dummy/app/models/dummy_user.rb +9 -0
- data/spec/dummy/app/models/dummy_user.rb~ +9 -0
- data/spec/dummy/app/models/user.rb~ +5 -0
- data/spec/dummy/app/views/dummy_model/show.html.erb +1 -0
- data/spec/dummy/app/views/dummy_model/show.html.erb~ +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +59 -0
- data/spec/dummy/config/application.rb~ +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/commontator.rb +158 -0
- data/spec/dummy/config/initializers/commontator.rb~ +157 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +7 -0
- data/spec/dummy/config/routes.rb~ +7 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/0_create_dummies.rb~ +48 -0
- data/spec/dummy/db/migrate/0_create_dummy_models.rb +7 -0
- data/spec/dummy/db/migrate/0_create_dummy_models.rb~ +7 -0
- data/spec/dummy/db/migrate/1_create_dummy_users.rb +7 -0
- data/spec/dummy/db/migrate/1_create_dummy_users.rb~ +7 -0
- data/spec/dummy/db/migrate/1_create_users.rb~ +7 -0
- data/spec/dummy/db/migrate/2_install_commontator.rb +49 -0
- data/spec/dummy/db/migrate/2_install_commontator.rb~ +49 -0
- data/spec/dummy/db/migrate/3_acts_as_votable_migration.rb +20 -0
- data/spec/dummy/db/schema.rb +84 -0
- data/spec/dummy/db/schema.rb~ +71 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +14298 -0
- data/spec/dummy/log/test.log +149321 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/tmp/cache/assets/CCB/1D0/sprockets%2F02d4b791eb831cf2057bf4703a1218d1 +0 -0
- data/spec/dummy/tmp/cache/assets/CD1/510/sprockets%2Fc69ee3cc5796188d873574179290a6ef +0 -0
- data/spec/dummy/tmp/cache/assets/D01/8B0/sprockets%2F0f196a1a50363b0a076ec6e1ee5417f6 +0 -0
- data/spec/dummy/tmp/cache/assets/D06/2F0/sprockets%2Fe1f674c11941d62aac1764ef3a7134e4 +0 -0
- data/spec/dummy/tmp/cache/assets/D54/060/sprockets%2Fe85565206c3e5fdf9dfeb367c85557b1 +0 -0
- data/spec/dummy/tmp/cache/assets/D9B/550/sprockets%2Fa41c8be5379abec3c0d0d98e2f0d5609 +0 -0
- data/spec/dummy/tmp/cache/assets/E01/2E0/sprockets%2Fa3fb9025f90ff05a6fd4afc7ded2692c +0 -0
- data/spec/lib/commontator/acts_as_commontable_spec.rb +26 -0
- data/spec/lib/commontator/acts_as_commontable_spec.rb~ +26 -0
- data/spec/lib/commontator/acts_as_commontator_spec.rb +25 -0
- data/spec/lib/commontator/acts_as_commontator_spec.rb~ +25 -0
- data/spec/lib/commontator/commontable_config_spec.rb +26 -0
- data/spec/lib/commontator/commontable_config_spec.rb~ +26 -0
- data/spec/lib/commontator/commontator_config_spec.rb +26 -0
- data/spec/lib/commontator/commontator_config_spec.rb~ +26 -0
- data/spec/lib/commontator/controller_includes_spec.rb +15 -0
- data/spec/lib/commontator/controller_includes_spec.rb~ +15 -0
- data/spec/lib/commontator/shared_helper_spec.rb +12 -0
- data/spec/lib/commontator/shared_helper_spec.rb~ +12 -0
- data/spec/lib/commontator_spec.rb +23 -0
- data/spec/lib/commontator_spec.rb~ +23 -0
- data/spec/spec_helper.rb +34 -0
- data/spec/spec_helper.rb~ +30 -0
- metadata +212 -2
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe ActsAsCommontable do
|
5
|
+
it 'must add methods to ActiveRecord and subclasses' do
|
6
|
+
ActiveRecord::Base.must_respond_to :acts_as_commontable
|
7
|
+
ActiveRecord::Base.must_respond_to :is_commontable
|
8
|
+
ActiveRecord::Base.is_commontable.must_equal false
|
9
|
+
DummyModel.must_respond_to :acts_as_commontable
|
10
|
+
DummyModel.must_respond_to :is_commontable
|
11
|
+
DummyModel.is_commontable.must_equal true
|
12
|
+
DummyUser.must_respond_to :acts_as_commontable
|
13
|
+
DummyUser.must_respond_to :is_commontable
|
14
|
+
DummyUser.is_commontable.must_equal false
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must modify models that act_as_commontable' do
|
18
|
+
dummy = DummyModel.create
|
19
|
+
dummy.must_respond_to :thread
|
20
|
+
dummy.must_respond_to :comments
|
21
|
+
dummy.must_respond_to :subscriptions
|
22
|
+
dummy.must_respond_to :commontable_config
|
23
|
+
dummy.commontable_config.must_be_instance_of CommontableConfig
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe ActsAsCommontable do
|
5
|
+
it 'must add methods to ActiveRecord and subclasses' do
|
6
|
+
ActiveRecord::Base.must_respond_to :acts_as_commontable
|
7
|
+
ActiveRecord::Base.must_respond_to :is_commontable
|
8
|
+
ActiveRecord::Base.is_commontable.must_equal false
|
9
|
+
DummyModel.must_respond_to :acts_as_commontable
|
10
|
+
DummyModel.must_respond_to :is_commontable
|
11
|
+
DummyModel.is_commontable.must_equal true
|
12
|
+
DummyUser.must_respond_to :acts_as_commontable
|
13
|
+
DummyUser.must_respond_to :is_commontable
|
14
|
+
DummyUser.is_commontable.must_equal false
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must modify models that act_as_commontable' do
|
18
|
+
dummy = DummyModel.create
|
19
|
+
dummy.must_respond_to :thread
|
20
|
+
dummy.must_respond_to :comments
|
21
|
+
dummy.must_respond_to :subscriptions
|
22
|
+
dummy.must_respond_to :commontable_config
|
23
|
+
dummy.commontable_config.must_be_instance_of Commontator::CommontableConfig
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe ActsAsCommontator do
|
5
|
+
it 'must add methods to ActiveRecord and subclasses' do
|
6
|
+
ActiveRecord::Base.must_respond_to :acts_as_commontator
|
7
|
+
ActiveRecord::Base.must_respond_to :is_commontator
|
8
|
+
ActiveRecord::Base.is_commontator.must_equal false
|
9
|
+
DummyModel.must_respond_to :acts_as_commontator
|
10
|
+
DummyModel.must_respond_to :is_commontator
|
11
|
+
DummyModel.is_commontator.must_equal false
|
12
|
+
DummyUser.must_respond_to :acts_as_commontator
|
13
|
+
DummyUser.must_respond_to :is_commontator
|
14
|
+
DummyUser.is_commontator.must_equal true
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must modify models that act_as_commontator' do
|
18
|
+
user = DummyUser.create
|
19
|
+
user.must_respond_to :comments
|
20
|
+
user.must_respond_to :subscriptions
|
21
|
+
user.must_respond_to :commontator_config
|
22
|
+
user.commontator_config.must_be_instance_of CommontatorConfig
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe ActsAsCommontator do
|
5
|
+
it 'must add methods to ActiveRecord and subclasses' do
|
6
|
+
ActiveRecord::Base.must_respond_to :acts_as_commontator
|
7
|
+
ActiveRecord::Base.must_respond_to :is_commontator
|
8
|
+
ActiveRecord::Base.is_commontator.must_equal false
|
9
|
+
DummyModel.must_respond_to :acts_as_commontator
|
10
|
+
DummyModel.must_respond_to :is_commontator
|
11
|
+
DummyModel.is_commontator.must_equal false
|
12
|
+
DummyUser.must_respond_to :acts_as_commontator
|
13
|
+
DummyUser.must_respond_to :is_commontator
|
14
|
+
DummyUser.is_commontator.must_equal true
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'must modify models that act_as_commontator' do
|
18
|
+
user = DummyUser.create
|
19
|
+
user.must_respond_to :comments
|
20
|
+
user.must_respond_to :subscriptions
|
21
|
+
user.must_respond_to :commontator_config
|
22
|
+
user.commontator_config.must_be_instance_of Commontator::CommontatorConfig
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe CommontableConfig do
|
5
|
+
it 'must respond to commontable attributes' do
|
6
|
+
config = CommontableConfig.new
|
7
|
+
COMMONTABLE_ATTRIBUTES.each do |attribute|
|
8
|
+
config.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'wont respond to engine or commontator attributes' do
|
13
|
+
config = CommontableConfig.new
|
14
|
+
(ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES).each do |attribute|
|
15
|
+
config.wont_respond_to attribute
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must be configurable' do
|
20
|
+
config = CommontableConfig.new(:comment_create_verb_present => 'create')
|
21
|
+
config.comment_create_verb_present.must_equal 'create'
|
22
|
+
config = CommontableConfig.new(:comment_create_verb_present => 'post')
|
23
|
+
config.comment_create_verb_present.must_equal 'post'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe CommontableConfig do
|
5
|
+
it 'must respond to commontable attributes' do
|
6
|
+
config = Commontator::CommontableConfig.new
|
7
|
+
Commontator::COMMONTABLE_ATTRIBUTES.each do |attribute|
|
8
|
+
config.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'wont respond to engine or commontator attributes' do
|
13
|
+
config = Commontator::CommontableConfig.new
|
14
|
+
(Commontator::ENGINE_ATTRIBUTES + Commontator::COMMONTATOR_ATTRIBUTES).each do |attribute|
|
15
|
+
config.wont_respond_to attribute
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must be configurable' do
|
20
|
+
config = Commontator::CommontableConfig.new(:comment_create_verb_present => 'create')
|
21
|
+
config.comment_create_verb_present.must_equal 'create'
|
22
|
+
config = Commontator::CommontableConfig.new(:comment_create_verb_present => 'post')
|
23
|
+
config.comment_create_verb_present.must_equal 'post'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe CommontatorConfig do
|
5
|
+
it 'must respond to commontator attributes' do
|
6
|
+
config = CommontatorConfig.new
|
7
|
+
COMMONTATOR_ATTRIBUTES.each do |attribute|
|
8
|
+
config.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'wont respond to engine or commontable attributes' do
|
13
|
+
config = CommontatorConfig.new
|
14
|
+
(ENGINE_ATTRIBUTES + COMMONTABLE_ATTRIBUTES).each do |attribute|
|
15
|
+
config.wont_respond_to attribute
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must be configurable' do
|
20
|
+
config = CommontatorConfig.new(:user_missing_name => 'Anon')
|
21
|
+
config.user_missing_name.must_equal 'Anon'
|
22
|
+
config = CommontatorConfig.new(:user_missing_name => 'Anonymous')
|
23
|
+
config.user_missing_name.must_equal 'Anonymous'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe CommontatorConfig do
|
5
|
+
it 'must respond to commontator attributes' do
|
6
|
+
config = Commontator::CommontatorConfig.new
|
7
|
+
Commontator::COMMONTATOR_ATTRIBUTES.each do |attribute|
|
8
|
+
config.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'wont respond to engine or commontable attributes' do
|
13
|
+
config = Commontator::CommontatorConfig.new
|
14
|
+
(Commontator::ENGINE_ATTRIBUTES + Commontator::COMMONTABLE_ATTRIBUTES).each do |attribute|
|
15
|
+
config.wont_respond_to attribute
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must be configurable' do
|
20
|
+
config = Commontator::CommontatorConfig.new(:user_missing_name => 'Anon')
|
21
|
+
config.user_missing_name.must_equal 'Anon'
|
22
|
+
config = Commontator::CommontatorConfig.new(:user_missing_name => 'Anonymous')
|
23
|
+
config.user_missing_name.must_equal 'Anonymous'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe ControllerIncludes do
|
5
|
+
it 'must add commontator_thread_show to ActionController instances' do
|
6
|
+
ActionController::Base.new.must_respond_to :commontator_thread_show
|
7
|
+
DummyModelsController.new.must_respond_to :commontator_thread_show
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'must add shared helper to ActionController and subclasses' do
|
11
|
+
ActionController::Base.helpers.must_respond_to :commontator_thread
|
12
|
+
DummyModelsController.helpers.must_respond_to :commontator_thread
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe Commontator::ControllerIncludes do
|
5
|
+
it 'must add commontator_thread_show to ActionController instances' do
|
6
|
+
ActionController::Base.new.must_respond_to :commontator_thread_show
|
7
|
+
DummyModelsController.new.must_respond_to :commontator_thread_show
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'must add shared helper to ActionController and subclasses' do
|
11
|
+
ActionController::Base.helpers.must_respond_to :commontator_thread
|
12
|
+
DummyModelsController.helpers.must_respond_to :commontator_thread
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe SharedHelper do
|
5
|
+
it 'must show commontator thread' do
|
6
|
+
view_context = DummyModelsController.new.view_context
|
7
|
+
thread_link = view_context.commontator_thread(DummyModel.create)
|
8
|
+
thread_link.wont_be_nil
|
9
|
+
thread_link.wont_be_empty
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe Commontator::SharedHelper do
|
5
|
+
it 'must show commontator thread' do
|
6
|
+
view_context = DummyModelsController.new.view_context
|
7
|
+
thread_link = view_context.commontator_thread(DummyModel.create)
|
8
|
+
thread_link.wont_be_nil
|
9
|
+
thread_link.wont_be_empty
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe Commontator do
|
5
|
+
it 'must respond to all attributes' do
|
6
|
+
(ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES + \
|
7
|
+
COMMONTABLE_ATTRIBUTES).each do |attribute|
|
8
|
+
Commontator.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must be configurable' do
|
13
|
+
Commontator.configure do |config|
|
14
|
+
config.current_user_method = 'user'
|
15
|
+
end
|
16
|
+
Commontator.current_user_method.must_equal 'user'
|
17
|
+
Commontator.configure do |config|
|
18
|
+
config.current_user_method = 'current_user'
|
19
|
+
end
|
20
|
+
Commontator.current_user_method.must_equal 'current_user'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Commontator
|
4
|
+
describe Commontator do
|
5
|
+
it 'must respond to all attributes' do
|
6
|
+
(ENGINE_ATTRIBUTES + COMMONTATOR_ATTRIBUTES + \
|
7
|
+
COMMONTABLE_ATTRIBUTES).each do |attribute|
|
8
|
+
Commontator.must_respond_to attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must be configurable' do
|
13
|
+
configure do |config|
|
14
|
+
config.current_user_method = 'user'
|
15
|
+
end
|
16
|
+
current_user_method.must_equal 'user'
|
17
|
+
configure do |config|
|
18
|
+
config.current_user_method = 'current_user'
|
19
|
+
end
|
20
|
+
current_user_method.must_equal 'current_user'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
require "minitest/autorun"
|
8
|
+
require "minitest/rails"
|
9
|
+
|
10
|
+
Rails.backtrace_cleaner.remove_silencers!
|
11
|
+
|
12
|
+
Commontator::ApplicationController.class_eval do
|
13
|
+
include ApplicationHelper
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup_model_spec
|
17
|
+
@user = DummyUser.create
|
18
|
+
@commontable = DummyModel.create
|
19
|
+
@thread = @commontable.thread
|
20
|
+
end
|
21
|
+
|
22
|
+
def setup_controller_spec
|
23
|
+
class_eval {include ApplicationHelper}
|
24
|
+
sign_out
|
25
|
+
setup_model_spec
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup_helper_spec
|
29
|
+
setup_model_spec
|
30
|
+
end
|
31
|
+
|
32
|
+
def setup_mailer_spec
|
33
|
+
setup_model_spec
|
34
|
+
end
|