Commit e1aad422a1441b92459065aad79689f09fec0f3e
1 parent
383b3373
Exists in
master
and in
12 other branches
Adds test to software events block
Closes #724 Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
1 changed file
with
31 additions
and
0 deletions
Show diff stats
src/noosfero-spb/software_communities/test/functional/software_communities_plugin_profile_controller_test.rb
@@ -57,6 +57,37 @@ class SoftwareCommunitiesPluginProfileControllerTest < ActionController::TestCas | @@ -57,6 +57,37 @@ class SoftwareCommunitiesPluginProfileControllerTest < ActionController::TestCas | ||
57 | assert_equal "Could not find the download file", session[:notice] | 57 | assert_equal "Could not find the download file", session[:notice] |
58 | end | 58 | end |
59 | 59 | ||
60 | + should "display limited community events" do | ||
61 | + @e1 = Event.new :name=>"Event 1", :body=>"Event 1 body", | ||
62 | + :start_date=>DateTime.now, | ||
63 | + :end_date=>(DateTime.now + 1.month) | ||
64 | + | ||
65 | + @e2 = Event.new :name=>"Event 2", :body=>"Event 2 body", | ||
66 | + :start_date=>(DateTime.now + 10.days), | ||
67 | + :end_date=>(DateTime.now + 11.days) | ||
68 | + | ||
69 | + @e3 = Event.new :name=>"Event 3", :body=>"Event 3 body", | ||
70 | + :start_date=>(DateTime.now + 20.days), | ||
71 | + :end_date=>(DateTime.now + 30.days) | ||
72 | + | ||
73 | + @software.community.events << @e1 | ||
74 | + @software.community.events << @e2 | ||
75 | + @software.community.events << @e3 | ||
76 | + @software.community.save! | ||
77 | + | ||
78 | + events_block = SoftwareEventsBlock.new | ||
79 | + events_block.amount_of_events = 2 | ||
80 | + events_block.display = "always" | ||
81 | + box = MainBlock.last.box | ||
82 | + events_block.box = box | ||
83 | + events_block.save! | ||
84 | + | ||
85 | + get :index, :profile=>@software.community.identifier | ||
86 | + assert_tag :tag => 'div', :attributes => { :class => 'software-community-events-block' }, :descendant => { :tag => 'a', :content => 'Event 1' } | ||
87 | + assert_tag :tag => 'div', :attributes => { :class => 'software-community-events-block' }, :descendant => { :tag => 'a', :content => 'Event 2' } | ||
88 | + assert_no_tag :tag => 'div', :attributes => { :class => 'software-community-events-block' }, :descendant => { :tag => 'a', :content => 'Event 3' } | ||
89 | + end | ||
90 | + | ||
60 | should "notice when given invalid download params" do | 91 | should "notice when given invalid download params" do |
61 | download_block = DownloadBlock.last | 92 | download_block = DownloadBlock.last |
62 | get :download_file, :profile=>@software.community.identifier, | 93 | get :download_file, :profile=>@software.community.identifier, |