-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_newsvine.rb
42 lines (37 loc) · 1.17 KB
/
test_newsvine.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require File.dirname(__FILE__) + '/test_helper.rb'
module Ubiquitously
class NewsvineTest < ActiveSupport::TestCase
context "Newsvine::Account" do
setup do
@user = Ubiquitously::Newsvine::Account.new
end
context "login" do
should "raise informative error if invalid password" do
@user.password = "bad password"
assert_raises(Ubiquitously::AuthenticationError) do
@user.login
end
assert_equal false, @user.logged_in?
end
should "login successfully if valid credentials" do
assert_equal true, @user.login
assert_equal true, @user.logged_in?
end
end
end
context "Newsvine::Post" do
setup do
@post = Ubiquitously::Newsvine::Post.new(
:title => "A Title",
:description => "A Description",
:tags => ["usability", "ruby", "web services", "open source"],
:url => "http://example.com/abcdef",
:user => Ubiquitously::Newsvine::Account.new
)
end
should "create a post" do
assert @post.save(:debug => true)
end
end
end
end