Commit ba4f52d8089d287b9853de1199398f733623ce1a
1 parent
b397fec9
Exists in
master
and in
29 other branches
Adding functional tests with design controllers to make sure that the videos are being displayed
Showing
5 changed files
with
269 additions
and
169 deletions
Show diff stats
plugins/video/README
1 | -README - DisplayContent (DisplayContent Plugin) | |
1 | +README - Video (Video Plugin) | |
2 | 2 | ================================ |
3 | 3 | |
4 | -DisplayContent is a plugin to allow the user adds a block where you could choose any of your content for display it. | |
4 | +Video is a plugin to allow the user adds a block where you could choose any url from youtube, vimeo and url's of the following file formats: mp4, ogg, ogv and webm. | |
5 | 5 | |
6 | -The DisplayContent block will be available for all layout columns of communities, peole, enterprises and environments. | |
7 | - | |
8 | -All the articles choosen are displayed as a list with a link for the title and the lead content. | |
9 | - | |
10 | -If a Blog or a Folder is choosen the block will display all articles inside the blog or the folder. | |
11 | - | |
12 | -Galleries are not displayed in this block. | |
6 | +The Video block will be available for all layout columns of communities, peole, enterprises and environments. | |
13 | 7 | |
14 | 8 | INSTALL |
15 | 9 | ======= |
... | ... | @@ -17,10 +11,10 @@ INSTALL |
17 | 11 | Enable Plugin |
18 | 12 | ------------- |
19 | 13 | |
20 | -Also, you need to enable DisplayContent Plugin at you Noosfero: | |
14 | +Also, you need to enable Video Plugin at you Noosfero: | |
21 | 15 | |
22 | 16 | cd <your_noosfero_dir> |
23 | -./script/noosfero-plugins enable display_content | |
17 | +./script/noosfero-plugins enable video | |
24 | 18 | |
25 | 19 | Active Plugin |
26 | 20 | ------------- |
... | ... | @@ -30,20 +24,10 @@ As a Noosfero administrator user, go to administrator panel: |
30 | 24 | - Click on "Enable/disable plugins" option |
31 | 25 | - Click on "Display Content Plugin" check-box |
32 | 26 | |
33 | -DEVELOPMENT | |
34 | -=========== | |
35 | - | |
36 | -Noosfero uses jQuery 1.5.1 and the jsTree doesn't works fine with this jQuery version. | |
37 | -Until Noosfero upgrade its JQuery version to a newer one is necessary to load jQuery 1.8.3 inside plugin and apply some changes in jsTree to avoid jQuery conflit. | |
38 | - | |
39 | -Get the Display Content (Noosfero with Display Content Plugin) development repository: | |
40 | - | |
41 | -$ git clone https://gitorious.org/+noosfero/noosfero/display_content | |
42 | - | |
43 | -Running DisplayContent tests | |
27 | +Running Video tests | |
44 | 28 | -------------------- |
45 | 29 | |
46 | -$ rake test:noosfero_plugins:display_content | |
30 | +$ rake test:noosfero_plugins:video | |
47 | 31 | |
48 | 32 | |
49 | 33 | Get Involved | ... | ... |
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,130 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +# Re-raise errors caught by the controller. | |
4 | +class EnvironmentDesignController; def rescue_action(e) raise e end; end | |
5 | + | |
6 | +class EnvironmentDesignControllerTest < ActionController::TestCase | |
7 | + | |
8 | + def setup | |
9 | + @controller = EnvironmentDesignController.new | |
10 | + @request = ActionController::TestRequest.new | |
11 | + @response = ActionController::TestResponse.new | |
12 | + | |
13 | + Environment.delete_all | |
14 | + User.delete_all | |
15 | + @environment = Environment.create!(defaults_for_environment.merge(:is_default => true)) | |
16 | + user = create_user('testinguser') | |
17 | + login_as(user.person.identifier) | |
18 | + @environment.add_admin(user.person) | |
19 | + @environment.save! | |
20 | + | |
21 | + @environment.enabled_plugins = ['VideoPlugin'] | |
22 | + @environment.save! | |
23 | + | |
24 | + VideoBlock.delete_all | |
25 | + | |
26 | + @block = VideoBlock.new | |
27 | + @block.box = @environment.boxes.first | |
28 | + @block.save! | |
29 | + end | |
30 | + | |
31 | + attr_accessor :environment, :block | |
32 | + | |
33 | + should 'display video-block-data class in profile block edition' do | |
34 | + block.url='youtube.com/?v=XXXXX' | |
35 | + block.save! | |
36 | + get :index | |
37 | + | |
38 | + assert_tag :div, :attributes => {:class => 'video-block-data'} | |
39 | + end | |
40 | + | |
41 | + should "display iframe tag in profile block edition on youtube url's" do | |
42 | + block.url='youtube.com/?v=XXXXX' | |
43 | + block.save | |
44 | + get :index | |
45 | + | |
46 | + assert_tag :tag => 'iframe' | |
47 | + end | |
48 | + | |
49 | + should "the width in iframe tag be defined on youtube url's" do | |
50 | + block.url='youtube.com/?v=XXXXX' | |
51 | + block.save | |
52 | + get :index | |
53 | + | |
54 | + assert_tag :tag => 'iframe', :attributes => {:width => '400px'} | |
55 | + end | |
56 | + | |
57 | + should "display iframe tag in profile block edition on vimeo url's" do | |
58 | + block.url='http://vimeo.com/98979' | |
59 | + block.save | |
60 | + get :index | |
61 | + | |
62 | + assert_tag :tag => 'iframe' | |
63 | + end | |
64 | + | |
65 | + should "the width in iframe tag be defined on vimeo url's" do | |
66 | + block.url='http://vimeo.com/98979' | |
67 | + block.save | |
68 | + get :index | |
69 | + | |
70 | + assert_tag :tag => 'iframe', :attributes => {:width => '400px'} | |
71 | + end | |
72 | + | |
73 | + should "display video tag in profile block edition for any video url" do | |
74 | + block.url='http://www.vmsd.com/98979.mp4' | |
75 | + block.save | |
76 | + get :index | |
77 | + | |
78 | + assert_tag :tag => 'video' | |
79 | + end | |
80 | + | |
81 | + should "the width in video tag be defined for any video url" do | |
82 | + block.url='http://www.vmsd.com/98979.mp4' | |
83 | + block.save | |
84 | + get :index | |
85 | + | |
86 | + assert_tag :tag => 'video', :attributes => {:width => '400px'} | |
87 | + end | |
88 | + | |
89 | + should 'the heigth in iframe tag be defined' do | |
90 | + block.url='youtube.com/?v=XXXXX' | |
91 | + block.save | |
92 | + get :index | |
93 | + | |
94 | + assert_tag :tag => 'iframe', :attributes => {:height => '315px'} | |
95 | + end | |
96 | + | |
97 | + should 'display youtube videos' do | |
98 | + block.url='youtube.com/?v=XXXXX' | |
99 | + block.save | |
100 | + get :index | |
101 | + | |
102 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'youtube'} } | |
103 | + end | |
104 | + | |
105 | + should 'display vimeo videos' do | |
106 | + block.url='http://vimeo.com/98979' | |
107 | + block.save | |
108 | + get :index | |
109 | + | |
110 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'vimeo'} } | |
111 | + end | |
112 | + | |
113 | + should 'display other videos' do | |
114 | + block.url='http://www.vmsd.com/98979.mp4' | |
115 | + block.save | |
116 | + get :index | |
117 | + | |
118 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } | |
119 | + end | |
120 | + | |
121 | + should 'display a messagem to register a new url' do | |
122 | + block.url='http://www.vmsd.com/test.pdf' | |
123 | + block.save | |
124 | + get :index | |
125 | + | |
126 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'span', :attributes => {:class => 'alert-block'} } | |
127 | + end | |
128 | + | |
129 | + | |
130 | +end | ... | ... |
plugins/video/test/functional/video_plugin_myprofile_controller_test.rb
... | ... | @@ -1,132 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | - | |
3 | -# Re-raise errors caught by the controller. | |
4 | -class ProfileDesignController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | -class ProfileDesignControllerTest < ActionController::TestCase | |
7 | - | |
8 | - def setup | |
9 | - @controller = ProfileDesignController.new | |
10 | - @request = ActionController::TestRequest.new | |
11 | - @response = ActionController::TestResponse.new | |
12 | - | |
13 | - user = create_user('testinguser') | |
14 | - login_as(user.login) | |
15 | - @profile = user.person | |
16 | - @environment = @profile.environment | |
17 | - | |
18 | - @environment.enabled_plugins = ['VideoPlugin'] | |
19 | - @environment.save! | |
20 | - | |
21 | - VideoBlock.delete_all | |
22 | - @box1 = Box.create!(:owner => @profile) | |
23 | - @profile.boxes = [@box1] | |
24 | - | |
25 | - @block = VideoBlock.new | |
26 | - @block.box = @box1 | |
27 | - @block.save! | |
28 | - | |
29 | - @profile.blocks<<@block | |
30 | - @profile.save! | |
31 | - end | |
32 | - | |
33 | - attr_accessor :profile, :block | |
34 | - | |
35 | - should 'display video-block-data class in profile block edition' do | |
36 | - block.url='youtube.com/?v=XXXXX' | |
37 | - block.save | |
38 | - get :index, :profile => profile.identifier | |
39 | - | |
40 | - assert_tag :div, :attributes => {:class => 'video-block-data'} | |
41 | - end | |
42 | - | |
43 | - should "display iframe tag in profile block edition on youtube url's" do | |
44 | - block.url='youtube.com/?v=XXXXX' | |
45 | - block.save | |
46 | - get :index, :profile => profile.identifier | |
47 | - | |
48 | - assert_tag :tag => 'iframe' | |
49 | - end | |
50 | - | |
51 | - should "the width in iframe tag be defined on youtube url's" do | |
52 | - block.url='youtube.com/?v=XXXXX' | |
53 | - block.save | |
54 | - get :index, :profile => profile.identifier | |
55 | - | |
56 | - assert_tag :tag => 'iframe', :attributes => {:width => '400px'} | |
57 | - end | |
58 | - | |
59 | - should "display iframe tag in profile block edition on vimeo url's" do | |
60 | - block.url='http://vimeo.com/98979' | |
61 | - block.save | |
62 | - get :index, :profile => profile.identifier | |
63 | - | |
64 | - assert_tag :tag => 'iframe' | |
65 | - end | |
66 | - | |
67 | - should "the width in iframe tag be defined on vimeo url's" do | |
68 | - block.url='http://vimeo.com/98979' | |
69 | - block.save | |
70 | - get :index, :profile => profile.identifier | |
71 | - | |
72 | - assert_tag :tag => 'iframe', :attributes => {:width => '400px'} | |
73 | - end | |
74 | - | |
75 | - should "display video tag in profile block edition for any video url" do | |
76 | - block.url='http://www.vmsd.com/98979.mp4' | |
77 | - block.save | |
78 | - get :index, :profile => profile.identifier | |
79 | - | |
80 | - assert_tag :tag => 'video' | |
81 | - end | |
82 | - | |
83 | - should "the width in video tag be defined for any video url" do | |
84 | - block.url='http://www.vmsd.com/98979.mp4' | |
85 | - block.save | |
86 | - get :index, :profile => profile.identifier | |
87 | - | |
88 | - assert_tag :tag => 'video', :attributes => {:width => '400px'} | |
89 | - end | |
90 | - | |
91 | - should 'the heigth in iframe tag be defined' do | |
92 | - block.url='youtube.com/?v=XXXXX' | |
93 | - block.save | |
94 | - get :index, :profile => profile.identifier | |
95 | - | |
96 | - assert_tag :tag => 'iframe', :attributes => {:height => '315px'} | |
97 | - end | |
98 | - | |
99 | - should 'display youtube videos' do | |
100 | - block.url='youtube.com/?v=XXXXX' | |
101 | - block.save | |
102 | - get :index, :profile => profile.identifier | |
103 | - | |
104 | - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'youtube'} } | |
105 | - end | |
106 | - | |
107 | - should 'display vimeo videos' do | |
108 | - block.url='http://vimeo.com/98979' | |
109 | - block.save | |
110 | - get :index, :profile => profile.identifier | |
111 | - | |
112 | - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'vimeo'} } | |
113 | - end | |
114 | - | |
115 | - should 'display other videos' do | |
116 | - block.url='http://www.vmsd.com/98979.mp4' | |
117 | - block.save | |
118 | - get :index, :profile => profile.identifier | |
119 | - | |
120 | - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } | |
121 | - end | |
122 | - | |
123 | - should 'display a messagem to register a new url' do | |
124 | - block.url='http://www.vmsd.com/test.pdf' | |
125 | - block.save | |
126 | - get :index, :profile => profile.identifier | |
127 | - | |
128 | - assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'span', :attributes => {:class => 'alert-block'} } | |
129 | - end | |
130 | - | |
131 | - | |
132 | -end |
plugins/video/test/functional/video_plugin_profile_design_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,132 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +# Re-raise errors caught by the controller. | |
4 | +class ProfileDesignController; def rescue_action(e) raise e end; end | |
5 | + | |
6 | +class ProfileDesignControllerTest < ActionController::TestCase | |
7 | + | |
8 | + def setup | |
9 | + @controller = ProfileDesignController.new | |
10 | + @request = ActionController::TestRequest.new | |
11 | + @response = ActionController::TestResponse.new | |
12 | + | |
13 | + user = create_user('testinguser') | |
14 | + login_as(user.login) | |
15 | + @profile = user.person | |
16 | + @environment = @profile.environment | |
17 | + | |
18 | + @environment.enabled_plugins = ['VideoPlugin'] | |
19 | + @environment.save! | |
20 | + | |
21 | + VideoBlock.delete_all | |
22 | + @box1 = Box.create!(:owner => @profile) | |
23 | + @profile.boxes = [@box1] | |
24 | + | |
25 | + @block = VideoBlock.new | |
26 | + @block.box = @box1 | |
27 | + @block.save! | |
28 | + | |
29 | + @profile.blocks<<@block | |
30 | + @profile.save! | |
31 | + end | |
32 | + | |
33 | + attr_accessor :profile, :block | |
34 | + | |
35 | + should 'display video-block-data class in profile block edition' do | |
36 | + block.url='youtube.com/?v=XXXXX' | |
37 | + block.save | |
38 | + get :index, :profile => profile.identifier | |
39 | + | |
40 | + assert_tag :div, :attributes => {:class => 'video-block-data'} | |
41 | + end | |
42 | + | |
43 | + should "display iframe tag in profile block edition on youtube url's" do | |
44 | + block.url='youtube.com/?v=XXXXX' | |
45 | + block.save | |
46 | + get :index, :profile => profile.identifier | |
47 | + | |
48 | + assert_tag :tag => 'iframe' | |
49 | + end | |
50 | + | |
51 | + should "the width in iframe tag be defined on youtube url's" do | |
52 | + block.url='youtube.com/?v=XXXXX' | |
53 | + block.save | |
54 | + get :index, :profile => profile.identifier | |
55 | + | |
56 | + assert_tag :tag => 'iframe', :attributes => {:width => '400px'} | |
57 | + end | |
58 | + | |
59 | + should "display iframe tag in profile block edition on vimeo url's" do | |
60 | + block.url='http://vimeo.com/98979' | |
61 | + block.save | |
62 | + get :index, :profile => profile.identifier | |
63 | + | |
64 | + assert_tag :tag => 'iframe' | |
65 | + end | |
66 | + | |
67 | + should "the width in iframe tag be defined on vimeo url's" do | |
68 | + block.url='http://vimeo.com/98979' | |
69 | + block.save | |
70 | + get :index, :profile => profile.identifier | |
71 | + | |
72 | + assert_tag :tag => 'iframe', :attributes => {:width => '400px'} | |
73 | + end | |
74 | + | |
75 | + should "display video tag in profile block edition for any video url" do | |
76 | + block.url='http://www.vmsd.com/98979.mp4' | |
77 | + block.save | |
78 | + get :index, :profile => profile.identifier | |
79 | + | |
80 | + assert_tag :tag => 'video' | |
81 | + end | |
82 | + | |
83 | + should "the width in video tag be defined for any video url" do | |
84 | + block.url='http://www.vmsd.com/98979.mp4' | |
85 | + block.save | |
86 | + get :index, :profile => profile.identifier | |
87 | + | |
88 | + assert_tag :tag => 'video', :attributes => {:width => '400px'} | |
89 | + end | |
90 | + | |
91 | + should 'the heigth in iframe tag be defined' do | |
92 | + block.url='youtube.com/?v=XXXXX' | |
93 | + block.save | |
94 | + get :index, :profile => profile.identifier | |
95 | + | |
96 | + assert_tag :tag => 'iframe', :attributes => {:height => '315px'} | |
97 | + end | |
98 | + | |
99 | + should 'display youtube videos' do | |
100 | + block.url='youtube.com/?v=XXXXX' | |
101 | + block.save | |
102 | + get :index, :profile => profile.identifier | |
103 | + | |
104 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'youtube'} } | |
105 | + end | |
106 | + | |
107 | + should 'display vimeo videos' do | |
108 | + block.url='http://vimeo.com/98979' | |
109 | + block.save | |
110 | + get :index, :profile => profile.identifier | |
111 | + | |
112 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'vimeo'} } | |
113 | + end | |
114 | + | |
115 | + should 'display other videos' do | |
116 | + block.url='http://www.vmsd.com/98979.mp4' | |
117 | + block.save | |
118 | + get :index, :profile => profile.identifier | |
119 | + | |
120 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'div', :attributes => {:class => 'video'} } | |
121 | + end | |
122 | + | |
123 | + should 'display a messagem to register a new url' do | |
124 | + block.url='http://www.vmsd.com/test.pdf' | |
125 | + block.save | |
126 | + get :index, :profile => profile.identifier | |
127 | + | |
128 | + assert_tag :tag => 'div', :attributes => {:class => 'video-block-data'}, :descendant => { :tag => 'span', :attributes => {:class => 'alert-block'} } | |
129 | + end | |
130 | + | |
131 | + | |
132 | +end | ... | ... |
plugins/video/test/unit/video_block_test.rb
... | ... | @@ -215,18 +215,4 @@ class VideoBlockTest < ActiveSupport::TestCase |
215 | 215 | instance_eval(& block.content) |
216 | 216 | end |
217 | 217 | |
218 | - should 'display box_organizer/iframe_video_block partial for youtube videos' do | |
219 | - block = VideoBlock.new | |
220 | - block.url = "youtube.com/?v=XXXXX" | |
221 | - | |
222 | -# self.expects(:render).with(:partial => 'box_organizer/iframe_video_block', :locals => { | |
223 | -# :url => block.format_embed_video_url_for_youtube, | |
224 | -# :width => block.width, | |
225 | -# :height => block.height | |
226 | -# }) | |
227 | -c = instance_eval(& block.content) | |
228 | -puts c.inspect | |
229 | - end | |
230 | - | |
231 | - | |
232 | 218 | end | ... | ... |