Sha256: 04637a6a6d2fc8f9c7c3d67483de046d014ed42cc9d0a1c1141b6a10dbe9b4bf

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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

class Admin::Images2IntegrationTest < ActionController::IntegrationTest
  def test_index
    Image.destroy_all
    @image = Image.create!(
      :image_file_name => '123.jpg', :image_content_type => 'image/jpeg', 
      :image_file_size => '456'
    )
    @path = "/images/#{@image.id}/original/123.jpg"
    get "/admin/images2"
    assert_response :success
    
    # should show the image in-line as an <img> tag
    assert_select("img[src=?]", @path)
    
    # should not show the image path on its own as a value
    assert_no_match(%r|<td[^>]*>#{@path}</td>|, response.body)
    
    # should show path text field
    assert_select('input[value=?]', "http://www.example.com#{@path}")
    
    # should not show an edit link since we can only create or index
    assert_select(
      'a[href=?]', "/admin/images2/edit/#{@image.id}", false
    )
      
    # should have a new link
    assert_select(
      "a[href=/admin/images2/new]", 'New image'
    )
  end
end

Version data entries

3 entries across 2 versions & 1 rubygems

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