Commit 03f7cd2a46f0252fcff46f3c3de9c9456436c4d8
1 parent
fa43549d
Exists in
master
and in
29 other branches
ActionItem3: starting features_controller
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@57 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
58 additions
and
3 deletions
Show diff stats
app/controllers/application.rb
app/models/virtual_community.rb
... | ... | @@ -2,9 +2,9 @@ class VirtualCommunity < ActiveRecord::Base |
2 | 2 | |
3 | 3 | # TODO: these are test features |
4 | 4 | EXISTING_FEATURES = { |
5 | - 'feature1' => _('Feature 1'), | |
6 | - 'feature2' => _('Feature 2'), | |
7 | - 'feature3' => _('Feature 3'), | |
5 | + 'feature1' => _('Enable Feature 1'), | |
6 | + 'feature2' => _('Enable Feature 2'), | |
7 | + 'feature3' => _('Enable Feature 3'), | |
8 | 8 | } |
9 | 9 | |
10 | 10 | # ################################################# | ... | ... |
... | ... | @@ -0,0 +1,13 @@ |
1 | +<h2><%= _('Enable/Disable features') %></h2> | |
2 | + | |
3 | +<table> | |
4 | + <% form_tag({:action => 'update_features'}) do %> | |
5 | + <% @features.each do |feature, text| %> | |
6 | + <tr> | |
7 | + <td><%= text %></td> | |
8 | + <td><%= check_box_tag "feature[#{feature}]" %></td> | |
9 | + </tr> | |
10 | + <% end %> | |
11 | + <tr><td colspan='2'><%= submit_tag %></td></tr> | |
12 | + <% end %> | |
13 | +</table> | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | +require 'features_controller' | |
3 | + | |
4 | +# Re-raise errors caught by the controller. | |
5 | +class FeaturesController; def rescue_action(e) raise e end; end | |
6 | + | |
7 | +class FeaturesControllerTest < Test::Unit::TestCase | |
8 | + def setup | |
9 | + @controller = FeaturesController.new | |
10 | + @request = ActionController::TestRequest.new | |
11 | + @response = ActionController::TestResponse.new | |
12 | + end | |
13 | + | |
14 | + def test_listing_features | |
15 | + get :index | |
16 | + assert_template 'index' | |
17 | + VirtualCommunity::EXISTING_FEATURES.each do |feature, text| | |
18 | + assert_tag(:tag => 'input', :attributes => { :type => 'checkbox', :name => "feature[#{feature}]" }) | |
19 | + end | |
20 | + end | |
21 | + | |
22 | + def test_update_features | |
23 | + fail 'Not implemented yet' | |
24 | + end | |
25 | + | |
26 | +end | ... | ... |