Sha256: 6c945d9daee6ded8735f476b22f106e571a8f7d6d04c4355503e4df04e8ffd34

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

module Ubiquitously
  class NewsvineTest < ActiveSupport::TestCase
    context "Newsvine::User" do
      setup do
        @user = Ubiquitously::Newsvine::User.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::User.new
        )
      end
      
      should "create a post" do
        assert @post.save(:debug => true)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ubiquitously-0.0.1.6 test/test_newsvine.rb