This repository has been archived by the owner on Dec 5, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matthew Van Horn
authored and
Matthew Van Horn
committed
Nov 29, 2008
1 parent
9d89444
commit 8aa9d33
Showing
4 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
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
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,48 @@ | ||
require 'test/unit' | ||
require 'yaml' | ||
require 'disqus' | ||
require 'disqus/api' | ||
require 'disqus/forum' | ||
require 'disqus/thread' | ||
require 'mocha' | ||
|
||
DISQUS_TEST = YAML.load(File.read(File.dirname(__FILE__) + "/config.yml")) | ||
|
||
class ThreadTest < Test::Unit::TestCase | ||
|
||
def setup | ||
Disqus.defaults[:api_key] = DISQUS_TEST["api_key"] | ||
end | ||
|
||
def test_thread_list | ||
mock_api_call(:get_thread_list) | ||
forum = create_forum | ||
list = Disqus::Thread.list(forum) | ||
assert_equal 1, list.size | ||
assert_equal list, [create_thread] | ||
end | ||
|
||
private | ||
|
||
def create_thread | ||
Disqus::Thread.new( 12345, | ||
create_forum, | ||
"this_is_a_thread", | ||
"This is a thread", | ||
"2008-01-03 14:44:07.627492", | ||
true, | ||
"http://www.example.com/testthread", | ||
"this_is_the_thread_identifier" ) | ||
end | ||
|
||
def create_forum | ||
Disqus::Forum.new(1234, "disqus-test", "Disqus Test", "2008-01-03 14:44:07.627492") | ||
end | ||
|
||
def mock_api_call(method_name) | ||
Disqus::Api.expects(method_name.to_sym).returns(JSON.parse(File.read(File.dirname(__FILE__) + "/responses/#{method_name}.json"))) | ||
end | ||
|
||
|
||
end | ||
|