Sha256: a51d2b314286ffff79c7f639b9338d4f04f105c98b01f95c0d92f45aab93a0b4

Contents?: true

Size: 861 Bytes

Versions: 5

Compression:

Stored size: 861 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

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-0.9.6.19 test/unit/news_items_test.rb
refinerycms-0.9.6.18 test/unit/news_items_test.rb
refinerycms-0.9.6.17 test/unit/news_items_test.rb
refinerycms-0.9.6.16 test/unit/news_items_test.rb
refinerycms-0.9.6.15 test/unit/news_items_test.rb