Sha256: c9d044e700366a3a2f23c4c33c3ebeba147576b88724dde151cd9def660a8700

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module AttachmentMagickTestHelper
  def assert_element_in(target, match)
    target = Nokogiri::HTML(target)
    target.xpath("//#{match}").present?
  end

  def assert_element_value(target, match, field)
    target = Nokogiri::HTML(target)
    target.xpath("//#{match}").first["#{field}"]
  end

  def create_artist(options={})
    default_options = {:name => "Johnny", :lastname => "Depp"}
    default_options.merge!(options)

    @artist = Artist.create(default_options)
    @artist.images.create(:photo => exemple_file)
    return @artist
  end

  def create_place(options={})
    default_options = {:name => "Las Vegas"}
    default_options.merge!(options)

    @place = Place.create(default_options)
    @place.images.create(:photo => exemple_file)
    return @place
  end

  def create_work(artist)
    default_options = {:name => "movie", :local => "Hollywood"}
    artist.works.create(default_options)
    artist.works.last.images.create(:photo => exemple_file)
  end

  def exemple_file
    File.expand_path('../dummy/public/images/little_girl.jpg', __FILE__)
  end

  def exemple_partial
    "layouts/custom_images_list"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attachment_magick-0.1.0 lib/attachment_magick/test/attachment_magick_test_helper.rb