Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Misc cleanups and de-WTF-ification. Migrated away from newgem.

  • Loading branch information...
commit 2888576d9d41c43e25e834960513393c056d390a 1 parent 8726125
@norman authored
View
1  .gitignore
@@ -1,6 +1,5 @@
.DS_Store
package
coverage
-test/config.yml
docs
pkg
View
21 Changelog.md
@@ -0,0 +1,21 @@
+# Changelog
+
+## 1.0.3 (2010-03-30)
+
+* Updates for API version 1.1 (Fabio Akita)
+* Misc cleanups (Fabio Akita, Stéphane Busso, Norman Clarke)
+
+## (1.0.2 2009-10-05)
+
+* The Disqus::API.post method now returns the response body rather than the response object (Nat Budin)
+* Disqus::API.create_post now complies with DISQUS's API requirements (Nat Budin)
+
+## (1.0.1 2009-01-19)
+
+* Improve docs (Quin Hoxie)
+* Add developer and container_id options for comment threads. (Quin Hoxie)
+
+## 1.0.0 2009-01-05
+
+* Support for Disqus API added (Matthew Van Horn)
+* Reorganized gem to use newgem
View
15 History.txt
@@ -1,15 +0,0 @@
-== 1.0.2 2009-10-05
- 2 bug fixes:
- * The Disqus::API.post method now returns the response body rather than the response object (Nat Budin)
- * Disqus::API.create_post now complies with DISQUS's API requirements (Nat Budin)
-
-== 1.0.1 2009-01-19
- 2 minor enhancements:
- * Improve docs (Quin Hoxie)
- * Add developer and container_id options for comment threads. (Quin Hoxie)
-
-== 1.0.0 2009-01-05
-* 1 major enhancement:
- * Support for Disqus API added (Matthew Van Horn)
-* 1 minor enhancement:
- * Reorganized gem to use newgem
View
18 LICENSE
@@ -0,0 +1,18 @@
+Copyright (c) 2008-2010 Norman Clarke
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
20 MIT-LICENSE
@@ -1,20 +0,0 @@
-Copyright (c) 2008 [name of plugin creator]
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
37 Manifest.txt
@@ -1,37 +0,0 @@
-History.txt
-MIT-LICENSE
-Manifest.txt
-README.rdoc
-Rakefile
-config/website.yml
-init.rb
-lib/disqus.rb
-lib/disqus/api.rb
-lib/disqus/author.rb
-lib/disqus/forum.rb
-lib/disqus/post.rb
-lib/disqus/thread.rb
-lib/disqus/version.rb
-lib/disqus/view_helpers.rb
-lib/disqus/widget.rb
-tasks/rcov.rake
-test/api_test.rb
-test/config.yml.sample
-test/forum_test.rb
-test/merb_test.rb
-test/post_test.rb
-test/rails_test.rb
-test/responses/bad_api_key.json
-test/responses/create_post.json
-test/responses/get_forum_api_key.json
-test/responses/get_forum_list.json
-test/responses/get_num_posts.json
-test/responses/get_thread_by_url.json
-test/responses/get_thread_list.json
-test/responses/get_thread_posts.json
-test/responses/thread_by_identifier.json
-test/responses/update_thread.json
-test/test_helper.rb
-test/thread_test.rb
-test/view_helpers_test.rb
-test/widget_test.rb
View
96 README.md
@@ -0,0 +1,96 @@
+# Disqus
+
+The Disqus Gem helps you easily integrate the [Disqus](http://disqus.com)
+commenting system into your Ruby-based website. It includes a Ruby wrapper for
+[Disqus's REST API](http://wiki.disqus.net/API), and views helpers to generate
+their Javasript widgets.
+
+## What is Disqus?
+
+From the Disqus website:
+
+> "Disqus, pronounced "discuss", is a service and tool for web comments and
+> discussions. The Disqus comment system can be plugged into any website, blog,
+> or application. Disqus makes commenting easier and more interactive, while
+> connecting websites and commenters across a thriving discussion community."
+>
+> "Disqus is a free service to the general public with absolutely no inline advertisements."
+
+
+### Getting it
+
+ gem install disqus
+
+### Using it
+
+#### Configure it
+
+ Disqus::defaults[:account] = "my_disqus_account"
+ # Optional, only if you're using the API
+ Disqus::defaults[:api_key] = "my_disqus_api_key"
+
+
+#### Options
+
+ :api_key => "" # your api key
+ :account => "", # your disqus account
+ :developer => false, # allows threads to work on localhost
+ :container_id => 'disqus_thread', # desired thread container
+ :avatar_size => 48, # squared pixel size of avatars
+ :color => "grey", # theme color
+ :default_tab => "popular", # default widget tab
+ :hide_avatars => false, # hide or show avatars
+ :hide_mods => true, # hide or show moderation
+ :num_items => 15, # number of comments to display
+ :show_powered_by => true, # show or hide powered by line
+ :orientation => "horizontal" # comment orientation
+
+#### Show the comment threads widget on a post page
+
+ # Loads the commenting system
+ disqus_thread
+
+ # Sets the inner html to the comment count for any links on the page that
+ # have the anchor "disqus_thread". For example, "View Comments" below would
+ # be replaced by "1 comment" or "23 comments" etc.
+ # <a href="http://my.website/article-permalink#disqus_thread">View Comments</a>
+ # <a href="http://my.website/different-permalink#disqus_thread">View Comments</a>
+ disqus_comment_counts
+
+#### Show the combo widget on a post page
+
+ disqus_combo(:color => "blue", :hide_mods => false, :num_items => 20)
+
+#### Show the comment count on a permalink
+
+ link_to("Permalink", post_path(@post, :anchor => "disqus_thread"))
+ ...
+ disqus_comment_counts
+
+#### Work with the Disqus API
+
+See the Disqus::Api class for more info on the Disqus API. You can also read the
+[Disqus developer info here](http://disqus.com/docs/api/).
+
+### Hack it
+
+Github repository:
+
+[http://github.com/norman/disqus](http://github.com/norman/disqus)
+
+### Learn more about Disqus:
+
+[http://disqus.com](http://disqus.com)
+
+### Thanks to the following contributors:
+
+* {Matt Van Horn}[http://github.com/mattvanhorn] - Disqus API
+* {Quin Hoxie}[http://github.com/qhoxie] - Merb support
+
+### Legal Stuff
+
+The Disqus Ruby gem was not created by, nor is officially supported by
+Disqus.com or Big Head Labs, Inc. Use it at your own risk and your own
+responsibility under the terms of the MIT License.
+
+Copyright (c) 2008-2010 Norman Clarke. Released under the MIT license
View
143 README.rdoc
@@ -1,143 +0,0 @@
-== Disqus Ruby Gem
-
-The Disqus Gem helps you easily integrate the {Disqus}[http://disqus.com]
-commenting system into your website. It works for any site programmed in Ruby,
-and has view helpers for Rails and Merb.
-
-Support for the Disqus Javascript widgets is stable. Disqus API support is
-"beta."
-
-=== What is Disqus?
-
-From the Disqus website:
-
-"Disqus, pronounced "discuss", is a service and tool for web comments and
-discussions. The Disqus comment system can be plugged into any website, blog,
-or application. Disqus makes commenting easier and more interactive, while
-connecting websites and commenters across a thriving discussion community."
-
-"Disqus is a free service to the general public with absolutely no inline advertisements."
-
-=== Get it
-
- gem install disqus
-
-==== Bleeding Edge
-
- gem install norman-disqus --source http://gems.github.com
-
-=== Use it:
-
-==== Configure it:
-
-===== Generic example:
-
- Disqus::defaults[:account] = "my_disqus_account"
- # Optional, only if you're using the API
- Disqus::defaults[:api_key] = "my_disqus_api_key"
-
-===== Rails example:
-
- # in config/development.rb (or production.rb, test.rb, etc.)
- config.after_initialize do
- Disqus::defaults[:account] = "my_disqus_account"
- # Optional, only if you're using the API
- Disqus::defaults[:api_key] = "my_disqus_api_key"
- end
-
-Note that here the "after initialize" is necessary, otherwise your settings
-won't be set properly.
-
-===== Merb example:
-
- # in config/init.rb
- Merb::BootLoader.after_app_loads do
- Disqus::defaults[:account] = "my_disqus_account"
- # Optional, only if you're using the API
- Disqus::defaults[:api_key] = "my_disqus_api_key"
- end
-
-Note that here the "after_app_loads" is necessary, otherwise your settings
-won't be set properly.
-
-===== Options
-
- :api_key => "" # your api key
- :account => "", # your disqus account
- :developer => false, # allows for threads to work on localhost
- :container_id => 'disqus_thread', # desired thread container
- :avatar_size => 48, # squared pixel size of avatars
- :color => "grey", # theme color
- :default_tab => "popular", # default widget tab
- :hide_avatars => false, # hide or show avatars
- :hide_mods => true, # hide or show moderation
- :num_items => 15, # number of comments to display
- :show_powered_by => true, # show or hide powered by line
- :orientation => "horizontal" # comment orientation
-
-==== Show the comment threads widget on a post page:
-
- # Loads the commenting system
- disqus_thread
-
- # Or if you're not using Rails/Merb:
- Disqus::Widget::thread
-
- # Sets the inner html to the comment count for any links on the page that
- # have the anchor "disqus_thread". For example, "View Comments" below would
- # be replaced by "1 comment" or "23 comments" etc.
- # <a href="http://my.website/article-permalink#disqus_thread">View Comments</a>
- # <a href="http://my.website/different-permalink#disqus_thread">View Comments</a>
- disqus_comment_counts
-
- # Or if you're not using Rails/Merb:
- Disqus::Widget::comment_counts
-
-==== Show the combo widget on a post page:
-
- disqus_combo(:color => "blue", :hide_mods => false, :num_items => 20)
-
- # Or for non-Rails/Merb:
- Disqus::Widget::combo(:color => "blue", :hide_mods => false, :num_items => 20)
-
-==== Show the comment count on a permalink:
-
- link_to("Permalink", post_path(@post, :anchor => "disqus_thread"))
- ...
- disqus_comment_counts
-
- # Or for non-Rails/Merb:
- Disqus::Widget::comment_counts
-
-==== Work with the Disqus API:
-
-See the Disqus::Api class for more info on the Disqus API. You can also read
-the {Disqus developer info here}[http://disqus.com/docs/api/].
-
-=== Hack it:
-
-Github repository:
-
- http://github.com/norman/disqus
-
-=== Submit bug reports:
-
-Please use our {Lighthouse}[http://randomba.lighthouseapp.com/projects/16065-disqus/].
-
-=== Learn more about Disqus:
-
-{http://disqus.com}[http://disqus.com]
-
-=== Thanks to the following contributors:
-
-* {Matt Van Horn}[http://github.com/mattvanhorn] - Disqus API
-* {Quin Hoxie}[http://github.com/qhoxie] - Merb support
-
-=== Legal Stuff
-
-The Disqus Ruby gem was not created by, nor is officially supported by
-Disqus.com or Big Head Labs, Inc. Use it at your own risk and your own
-responsibility under the terms of the MIT License.
-
-Copyright (c) 2008 {Norman Clarke}[mailto:norman@randomba.org], released under
-the MIT license
View
42 Rakefile
@@ -1,24 +1,26 @@
-require 'newgem'
-require 'hoe'
+require "rake"
+require "rake/testtask"
+require "rake/gempackagetask"
+require "rake/rdoctask"
+require "rake/clean"
require 'lib/disqus/version'
-$hoe = Hoe.new("disqus", Disqus::Version::STRING) do |p|
- p.rubyforge_name = "disqus"
- p.author = ['Norman Clarke', 'Matthew Van Horn']
- p.email = ['norman@njclarke.com', 'mattvanhorn@gmail.com']
- p.summary = "Integrates Disqus commenting system into your Ruby-powered site."
- p.description = 'Integrates Disqus into your Ruby-powered site. Works with any Ruby website, and has view helpers for Rails and Merb.'
- p.url = 'http://disqus.rubyforge.org'
- p.test_globs = ['test/**/*_test.rb']
- p.extra_deps << ['json']
- p.extra_dev_deps = [
- ['newgem', ">= #{::Newgem::VERSION}"],
- ['mocha']
- ]
- p.rsync_args = '-av --delete --ignore-errors'
- changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
- p.remote_rdoc_dir = ""
+CLEAN << "pkg" << "doc" << "coverage"
+
+Rake::GemPackageTask.new(eval(File.read("disqus.gemspec"))) { |pkg| }
+Rake::TestTask.new(:test) { |t| t.pattern = "test/*_test.rb" }
+
+Rake::RDocTask.new do |r|
+ r.rdoc_dir = "doc"
+ r.rdoc_files.include "lib/**/*.rb"
end
-require 'newgem/tasks'
-Dir['tasks/**/*.rake'].each { |t| load t }
+begin
+ require "rcov/rcovtask"
+ Rcov::RcovTask.new do |r|
+ r.test_files = FileList["test/**/*_test.rb"]
+ r.verbose = true
+ r.rcov_opts << "--exclude gems/*"
+ end
+rescue LoadError
+end
View
2  config/website.yml
@@ -1,2 +0,0 @@
-host: compay@rubyforge.org
-remote_dir: /var/www/gforge-projects/disqus
View
20 disqus.gemspec
@@ -0,0 +1,20 @@
+spec = Gem::Specification.new do |s|
+
+ s.name = "disqus"
+ s.version = Disqus::Version::STRING
+ s.rubyforge_project = "disqus"
+ s.authors = ['Norman Clarke', 'Matthew Van Horn']
+ s.email = ['norman@njclarke.com', 'mattvanhorn@gmail.com']
+ s.summary = "Integrates Disqus commenting system into your Ruby-powered site."
+ s.description = 'Integrates Disqus into your Ruby-powered site. Works with any Ruby website, and has view helpers for Rails and Merb.'
+ s.homepage = 'http://github.com/norman/disqus'
+ s.has_rdoc = true
+ s.platform = Gem::Platform::RUBY
+
+ s.files = Dir["lib/**/*.rb", "lib/**/*.rake", "*.rdoc", "LICENSE", "Rakefile", "test/**/*.*"]
+ s.test_files = Dir.glob "test/**/*_test.rb"
+
+ s.add_dependency 'json'
+ s.add_development_dependency 'mocha'
+
+end
View
7 init.rb
@@ -1,7 +0,0 @@
-require 'disqus'
-require 'disqus/api'
-require 'disqus/author'
-require 'disqus/forum'
-require 'disqus/post'
-require 'disqus/thread'
-require 'disqus/version'
View
68 lib/disqus.rb
@@ -1,5 +1,7 @@
-require 'disqus/widget'
-
+%w[api author forum post thread version view_helpers widget].each do |file|
+ require File.join(File.dirname(__FILE__), "disqus", file)
+end
+
# == From the {Disqus Website}[http://disqus.com]:
# "Disqus, pronounced "discuss", is a service and tool for web comments and
@@ -19,54 +21,32 @@
module Disqus
@defaults = {
- :api_key => "",
- :account => "",
- :developer => false,
- :container_id => 'disqus_thread',
- :avatar_size => 48,
- :color => "grey",
- :default_tab => "popular",
- :hide_avatars => false,
- :hide_mods => true,
- :num_items => 15,
+ :api_key => "",
+ :account => "",
+ :developer => false,
+ :container_id => 'disqus_thread',
+ :avatar_size => 48,
+ :color => "grey",
+ :default_tab => "popular",
+ :hide_avatars => false,
+ :hide_mods => true,
+ :num_items => 15,
:show_powered_by => true,
- :orientation => "horizontal"
+ :orientation => "horizontal"
}
# Disqus defaults:
- # :account => "",
- # :avatar_size => 48,
- # :color => "grey",
- # :default_tab => "popular",
- # :hide_avatars => false,
- # :hide_mods => true,
- # :num_items => 15,
+ # :account => "",
+ # :avatar_size => 48,
+ # :color => "grey",
+ # :default_tab => "popular",
+ # :hide_avatars => false,
+ # :hide_mods => true,
+ # :num_items => 15,
# :show_powered_by => true,
- # :orientation => "horizontal"
+ # :orientation => "horizontal"
def self.defaults
@defaults
end
-
- # Load the view helpers if the gem is included in a Rails app.
- def self.enable_rails
- return if ActionView::Base.instance_methods.include? 'disqus_thread'
- require 'disqus/view_helpers'
- ActionView::Base.class_eval { include Disqus::ViewHelpers }
- end
-
- # Load the view helpers if the gem is included in a Merb app.
- def self.enable_merb
- return if Merb::Controller.instance_methods.include? 'disqus_thread'
- require 'disqus/view_helpers'
- Merb::Controller.class_eval { include Disqus::ViewHelpers }
- end
-
-end
-if defined?(Rails) and defined?(ActionView)
- Disqus::enable_rails
-end
-
-if defined?(Merb)
- Disqus::enable_merb
-end
+end
View
6 lib/disqus/all.rb
@@ -1,6 +0,0 @@
-require 'disques/api'
-require 'disques/author'
-require 'disques/forum'
-require 'disques/post'
-require 'disques/thread'
-require 'disques/version'
View
1  lib/disqus/api.rb
@@ -1,5 +1,4 @@
require 'open-uri'
-require 'rubygems'
require 'json'
require 'net/http'
require 'uri'
View
8 lib/disqus/version.rb
@@ -1,8 +1,8 @@
-module Disqus #:nodoc:
- module Version #:nodoc:
+module Disqus
+ module Version
MAJOR = 1
MINOR = 0
- TINY = 2
+ TINY = 3
STRING = [MAJOR, MINOR, TINY].join('.')
end
-end
+end
View
52 lib/disqus/view_helpers.rb
@@ -1,45 +1,9 @@
-module Disqus
-
- # Shortcuts to access the widgets as simple functions as opposed to using
- # their full qualified names. These helpers are loaded automatically in
- # Rails and Merb apps.
- #
- # For Sinatra, Camping, Nitro or other frameworks, you can include the
- # helper if you wish, or use the fully-qualified names. Really this is just
- # here for aesthetic purposes and to make it less likely to step on anyone's
- # namespace.
- module ViewHelpers
-
- # See Disqus::Widget.thread
- def disqus_thread(options = {})
- Disqus::Widget::thread(options)
- end
-
- # See Disqus::Widget.comment_counts
- def disqus_comment_counts(options = {})
- Disqus::Widget::comment_counts(options)
- end
-
- # See Disqus::Widget.top_commenters
- def disqus_top_commenters(options = {})
- Disqus::Widget::top_commenters(options)
- end
-
- # See Disqus::Widget.popular_threads
- def disqus_popular_threads(options = {})
- Disqus::Widget::popular_threads(options)
- end
-
- # See Disqus::Widget.recent_comments
- def disqus_recent_comments(options = {})
- Disqus::Widget::recent_comments(options)
- end
-
- # See Disqus::Widget.combo
- def disqus_combo(options = {})
- Disqus::Widget::combo(options)
- end
-
- end
-
+# Shortcuts to access the widgets as simple functions as opposed to using
+# their full qualified names.
+%w[combo comment_counts popular_threads recent_comments thread top_commenters].each do |method|
+ eval(<<-EOM)
+ def disqus_#{method}(options = {})
+ Disqus::Widget.#{method}(options)
+ end
+ EOM
end
View
23 tasks/rcov.rake
@@ -1,23 +0,0 @@
-desc "Run RCov"
-task :rcov do
- run_coverage Dir["test/**/*_test.rb"]
-end
-
-def run_coverage(files)
- rm_f "coverage"
- rm_f "coverage.data"
- if files.length == 0
- puts "No files were specified for testing"
- return
- end
- files = files.join(" ")
- if PLATFORM =~ /darwin/
- exclude = '--exclude "gems/"'
- else
- exclude = '--exclude "rubygems"'
- end
- rcov = "rcov -Ilib:test --sort coverage --text-report #{exclude} --no-validator-links"
- cmd = "#{rcov} #{files}"
- puts cmd
- sh cmd
-end
View
1  test/api_test.rb
@@ -3,7 +3,6 @@
class ApiTest < Test::Unit::TestCase
def setup
- require 'disqus'
Disqus.defaults[:api_key] = DISQUS_TEST["api_key"]
end
View
3  test/config.yml.sample
@@ -1,3 +0,0 @@
-# This can be used to do actual calls to the API rather than use mocks during
-# testing. This can be useful to verify tests against API changes.
-api_key: 'YOUR DISQUS USER API KEY GOES HERE'
View
1  test/forum_test.rb
@@ -3,7 +3,6 @@
class ForumTest < Test::Unit::TestCase
def setup
- require 'disqus'
Disqus.defaults[:api_key] = DISQUS_TEST["api_key"]
stub_api_call(:get_forum_api_key).returns("FAKE_FORUM_API_KEY")
end
View
15 test/merb_test.rb
@@ -1,15 +0,0 @@
-require 'test/unit'
-
-module Merb
- class Controller
- end
-end
-
-class MerbTest < Test::Unit::TestCase
-
- def test_view_helpers_should_be_included
- require 'disqus'
- assert Merb::Controller.new.disqus_thread
- end
-
-end
View
1  test/post_test.rb
@@ -3,7 +3,6 @@
class PostTest < Test::Unit::TestCase
def setup
- require 'disqus'
Disqus.defaults[:api_key] = DISQUS_TEST["api_key"]
end
View
18 test/rails_test.rb
@@ -1,18 +0,0 @@
-require 'test/unit'
-
-class Rails
-end
-
-module ActionView
- class Base
- end
-end
-
-class RailsTest < Test::Unit::TestCase
-
- def test_view_helpers_should_be_included
- require 'disqus'
- assert ActionView::Base.new.disqus_thread
- end
-
-end
View
13 test/test_helper.rb
@@ -1,13 +1,14 @@
+require 'rubygems'
require 'test/unit'
require 'yaml'
-require 'disqus/api'
-require 'disqus/forum'
-require 'disqus/thread'
-require 'disqus/post'
-require 'disqus/author'
require 'mocha'
+require File.join(File.dirname(__FILE__), "..", "lib", "disqus")
-DISQUS_TEST = YAML.load(File.read(File.dirname(__FILE__) + "/config.yml"))
+DISQUS_TEST = {
+ # Only if you want to run against a live server. Not generally useful, you
+ # should be using stubs.
+ :api_key => "YOUR API KEY GOES HERE"
+}
def create_forum
forum = Disqus::Forum.new(1234, "disqus-test", "Disqus Test", "2008-01-03 14:44:07.627492")
View
1  test/thread_test.rb
@@ -3,7 +3,6 @@
class ThreadTest < Test::Unit::TestCase
def setup
- require 'disqus'
Disqus.defaults[:api_key] = DISQUS_TEST["api_key"]
stub_api_call(:get_forum_api_key)
end
View
37 test/view_helpers_test.rb
@@ -1,37 +0,0 @@
-require 'test/unit'
-require 'disqus'
-require 'disqus/view_helpers'
-
-class ViewHelpersTest < Test::Unit::TestCase
-
- include Disqus::ViewHelpers
-
- def setup
- Disqus::defaults[:account] = "tests"
- end
-
- def test_disqus_thread
- assert disqus_thread
- end
-
- def test_disqus_comment_counts
- assert disqus_comment_counts
- end
-
- def test_disqus_top_commenters
- assert disqus_top_commenters
- end
-
- def test_disqus_popular_threads
- assert disqus_popular_threads
- end
-
- def test_disqus_recent_comments
- assert disqus_recent_comments
- end
-
- def test_disqus_combo
- assert disqus_combo
- end
-
-end
View
23 test/widget_test.rb
@@ -1,6 +1,3 @@
-require 'test/unit'
-require 'disqus'
-
class DisqusWidgetTest < Test::Unit::TestCase
def setup
@@ -8,50 +5,50 @@ def setup
end
def test_thread
- assert Disqus::Widget::thread
+ assert disqus_thread
end
def test_comment_counts
- assert Disqus::Widget::comment_counts
+ assert disqus_comment_counts
end
def test_combo
- assert Disqus::Widget::combo
+ assert disqus_combo
end
def test_recent_comments
- assert Disqus::Widget::recent_comments
+ assert disqus_recent_comments
end
def test_popular_threads
- assert Disqus::Widget::popular_threads
+ assert disqus_popular_threads
end
def test_top_commenters
- assert Disqus::Widget::top_commenters
+ assert disqus_top_commenters
end
def test_invalid_default_tab
assert_raises ArgumentError do
- Disqus::Widget::combo(:default_tab => "test")
+ disqus_combo(:default_tab => "test")
end
end
def test_invalid_color
assert_raises ArgumentError do
- Disqus::Widget::combo(:color => "test")
+ disqus_combo(:color => "test")
end
end
def test_invalid_num_items
assert_raises ArgumentError do
- Disqus::Widget::combo(:num_items => 100)
+ disqus_combo(:num_items => 100)
end
end
def test_invalid_avatar_size
assert_raises ArgumentError do
- Disqus::Widget::top_commenters(:avatar_size => 100)
+ disqus_top_commenters(:avatar_size => 100)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.