Module: AttachmentMagickTestHelper
- Defined in:
- lib/attachment_magick/test/attachment_magick_test_helper.rb
Instance Method Summary collapse
- #assert_element_in(target, match) ⇒ Object
- #assert_element_value(target, match, field) ⇒ Object
- #create_artist(options = {}) ⇒ Object
- #create_place(options = {}) ⇒ Object
- #create_work(artist) ⇒ Object
- #example_file ⇒ Object
- #example_partial ⇒ Object
- #example_vimeo ⇒ Object
- #example_youtube ⇒ Object
Instance Method Details
#assert_element_in(target, match) ⇒ Object
2 3 4 5 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 2 def assert_element_in(target, match) target = Nokogiri::HTML(target) target.xpath("//#{match}").present? end |
#assert_element_value(target, match, field) ⇒ Object
7 8 9 10 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 7 def assert_element_value(target, match, field) target = Nokogiri::HTML(target) target.xpath("//#{match}").first["#{field}"] end |
#create_artist(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 12 def create_artist(={}) = {:name => "Johnny", :lastname => "Depp"} .merge!() @artist = Artist.create() @artist.images.create(:photo => example_file) return @artist end |
#create_place(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 21 def create_place(={}) = {:name => "Las Vegas"} .merge!() @place = Place.create() @place.images.create(:photo => example_file) return @place end |
#create_work(artist) ⇒ Object
30 31 32 33 34 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 30 def create_work(artist) = {:name => "movie", :local => "Hollywood"} artist.works.create() artist.works.last.images.create(:photo => example_file) end |
#example_file ⇒ Object
36 37 38 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 36 def example_file fixture_file_upload('little_girl.jpg', 'image/jpg') end |
#example_partial ⇒ Object
48 49 50 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 48 def example_partial "layouts/custom_images_list" end |
#example_vimeo ⇒ Object
44 45 46 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 44 def example_vimeo 'http://vimeo.com/14051767' end |
#example_youtube ⇒ Object
40 41 42 |
# File 'lib/attachment_magick/test/attachment_magick_test_helper.rb', line 40 def example_youtube 'http://www.youtube.com/watch?v=FUe83k3t_0s' end |