Sha256: 0dbe2983112ce249bb1cc85b1992a35c3ac577ef03b57ef6d063c653b7093926

Contents?: true

Size: 921 Bytes

Versions: 9

Compression:

Stored size: 921 Bytes

Contents

require 'test_helper'

module Disclaimer
  class DocumentTest < ActiveSupport::TestCase
    def setup
      @document = Document.find(1)
      @segment = Segment.find(1)
    end
    
    def test_setup
      assert_equal(1, @document.id)
    end
    
    def test_segment_holder_for
      segment_holder = @segment.segment_holders.first
      assert_equal(segment_holder, @document.segment_holder_for(@segment))
    end 
    
    def test_name_under_scored_on_save
      @document.update_attribute(:name, "This is a Name")
      assert_equal('this_is_a_name', @document.name)
    end
    
    def test_title_if_empty
      @document.title = ""
      @document.name = "this_is_a_name"
      assert_equal("This is a name", @document.title)
    end
    
    def test_title_if_nil
      @document.title = nil
      @document.name = "this_is_a_name"
      assert_equal("This is a name", @document.title)
    end    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
disclaimer-0.1.1 test/unit/disclaimer/document_test.rb
disclaimer-0.1.0 test/unit/disclaimer/document_test.rb
disclaimer-0.0.7 test/unit/disclaimer/document_test.rb
disclaimer-0.0.6 test/unit/disclaimer/document_test.rb
disclaimer-0.0.5 test/unit/disclaimer/document_test.rb
disclaimer-0.0.4 test/unit/disclaimer/document_test.rb
disclaimer-0.0.3 test/unit/disclaimer/document_test.rb
disclaimer-0.0.2 test/unit/disclaimer/document_test.rb
disclaimer-0.0.1 test/unit/disclaimer/document_test.rb