Sha256: d6d33a6ef51d27a45ca34e5965e2db94222e0214879740ec4d6d48ec22145ebd

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")

class Admin::BlogPosts6IntegrationTest < ActionController::IntegrationTest
  def setup
    User.destroy_all
    @user = User.create! :username => 'soren'
  end
  
  def test_index_when_there_is_one_record_and_15_or_less_users
    BlogPost.destroy_all
    @blog_post = BlogPost.create!(
      :title => "blog post title", :body => 'blog post body',
      :user => @user
    )
    tag1 = Tag.find_or_create_by_tag 'tag1'
    BlogPostTag.create! :blog_post => @blog_post, :tag => tag1
    tag2 = Tag.find_or_create_by_tag 'tag2'
    BlogPostTag.create! :blog_post => @blog_post, :tag => tag2
    User.count.downto(15) do
      user = User.find(:first, :conditions => ['id != ?', @user.id])
      user.destroy
    end
    
    BlogPost.create!(
      :title => "return nil", :body => 'blog post body', :user => @user
    )
    get "/admin/blog_posts6"
    assert_response :success
    
    # should show a link to /admin/comments/new because extra_right_column_links_for_index is defined in the helper
    assert_select('td') do
      assert_select(
        "a[href=?]",
        "/admin/comments/new?comment[blog_post_id]=#{@blog_post.id}",
        :text => "New comment"
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin_assistant-2.1.0 rails_3_0/test/integration/admin/blog_posts6_integration_test.rb
admin_assistant-2.0.1 rails_3_test/test/integration/admin/blog_posts6_integration_test.rb