ref: master
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
require_relative '../test_helper' class EnvironmentDesignControllerTest < ActionController::TestCase def setup @controller = EnvironmentDesignController.new Environment.delete_all User.delete_all @environment = Environment.create!(defaults_for_environment.merge(:is_default => true)) user = create_user('testinguser') login_as(user.person.identifier) @environment.add_admin(user.person) @environment.save! @environment.enabled_plugins = ['VideoPlugin'] @environment.save! VideoPlugin::VideoBlock.delete_all @block = VideoPlugin::VideoBlock.new @block.box = @environment.boxes.first @block.save! end attr_accessor :environment, :block should 'display video-block-data class in profile block edition' do block.url='youtube.com/?v=XXXXX' block.save! get :index assert_tag :div, :attributes => {:class => 'video-block-data'} end should "display iframe tag in profile block edition on youtube url's" do block.url='youtube.com/?v=XXXXX' block.save get :index assert_tag :tag => 'iframe' end should "the width in iframe tag be defined on youtube url's" do block.url='youtube.com/?v=XXXXX' block.save get :index assert_tag :tag => 'iframe', :attributes => {:width => '400px'} end should "display iframe tag in profile block edition on vimeo url's" do block.url='http://vimeo.com/98979' block.save get :index assert_tag :tag => 'iframe' end should "the width in iframe tag be defined on vimeo url's" do block.url='http://vimeo.com/98979' block.save get :index assert_tag :tag => 'iframe', :attributes => {:width => '400px'} end should "display video tag in profile block edition for any video url" do block.url='http://www.vmsd.com/98979.mp4' block.save get :index assert_tag :tag => 'video' end should "the width in video tag be defined for any video url" do block.url='http://www.vmsd.com/98979.mp4' block.save get :index assert_tag :tag => 'video', :attributes => {:width => '400px'} end should 'the heigth in iframe tag be defined' do block.url='youtube.com/?v=XXXXX' block.save get :index assert_tag :tag => 'iframe', :attributes => {:height => '315px'} end should 'display youtube videos' do block.url='youtube.com/?v=XXXXX' block.save get :index assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'youtube'} } end should 'display vimeo videos' do block.url='http://vimeo.com/98979' block.save get :index assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'vimeo'} } end should 'display other videos' do block.url='http://www.vmsd.com/98979.mp4' block.save get :index assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } end should 'display a message to register a new url' do block.url='http://www.vmsd.com/test.pdf' block.save get :index assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'span', :attributes => {:class => 'alert-block'} } end end |