Sha256: 85fb03343586624b2c09e75cfe37c42c65b2405ec5b2304d4a8c4c019fedf148

Contents?: true

Size: 880 Bytes

Versions: 8

Compression:

Stored size: 880 Bytes

Contents

require 'test_helper'

class NewsItemsTest < ActiveSupport::TestCase

  fixtures :news_items

  def setup
    @new_news_item = NewsItem.new
    @new_valid_news_item = NewsItem.new(:title => "valid post", :body => "yep looks valid", :publish_date => Date.today)
  end
  
  def test_should_not_save_without_title_and_body
    assert !@new_news_item.save
    
    assert_equal "can't be blank", @new_news_item.errors.on('title')
    assert_equal "can't be blank", @new_news_item.errors.on('body')
    assert_equal "can't be blank", @new_news_item.errors.on('publish_date')
    
    assert @new_valid_news_item.save
  end
  
  def test_per_page
    assert_equal 20, NewsItem.per_page
  end
  
  def test_named_scopes
    assert_equal 2, NewsItem.published.size
    assert NewsItem.latest.size < 10
    
    assert_equal news_items(:new_team_member), NewsItem.latest.first
  end
  
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
jacobat-refinerycms-0.9.6.14 test/unit/news_items_test.rb
refinerycms-0.9.6.14 test/unit/news_items_test.rb
refinerycms-0.9.6.13 test/unit/news_items_test.rb
refinerycms-0.9.6.12 test/unit/news_items_test.rb
refinerycms-0.9.6.11 test/unit/news_items_test.rb
refinerycms-0.9.6.10 test/unit/news_items_test.rb
refinerycms-0.9.6.9 test/unit/news_items_test.rb
refinerycms-0.9.6.8 test/unit/news_items_test.rb