Commit 71a7cfbd7d4a5e34ab19222e7a07380a12a97846

Authored by AntonioTerceiro
1 parent 4fdc5649

ActionItem8: making tests pass (several changes)



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@321 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/account_controller.rb
... ... @@ -30,7 +30,7 @@ class AccountController < ApplicationController
30 30 return unless request.post?
31 31 @user.save!
32 32 self.current_user = @user
33   - redirect_back_or_default(:controller => '/account', :action => 'index')
  33 + redirect_back_or_default(:controller => 'account', :action => 'index')
34 34 flash[:notice] = _("Thanks for signing up!")
35 35 rescue ActiveRecord::RecordInvalid
36 36 render :action => 'signup'
... ...
app/controllers/application.rb
... ... @@ -12,13 +12,6 @@ class ApplicationController < ActionController::Base
12 12 before_filter :detect_stuff_by_domain
13 13 attr_reader :virtual_community
14 14  
15   - before_filter :load_owner
16   - # Load the owner
17   - def load_owner
18   - # TODO: this should not be hardcoded
19   - @owner = Profile.find(1) if Profile.exists?(1)
20   - end
21   -
22 15 protected
23 16  
24 17 # TODO: move this logic somewhere else (Domain class?)
... ...
app/models/enterprise.rb
1 1 #An enterprise is a kind of organization. According to the system concept, only enterprises can offer products/services and ahave to be validated by an validation entity
2 2 class Enterprise < Organization
3   - belongs_to :validation_entity, :class_name => 'organization'
  3 + belongs_to :validation_entity, :class_name => 'organization', :foreign_key => 'validation_entity_id'
4 4 end
... ...
test/fixtures/organizations.yml
... ... @@ -1,5 +0,0 @@
1   -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2   -one:
3   - id: 1
4   -two:
5   - id: 2
test/functional/application_controller_test.rb
... ... @@ -29,11 +29,6 @@ class ApplicationControllerTest &lt; Test::Unit::TestCase
29 29 assert_tag :tag => 'span', :content => 'post_only'
30 30 end
31 31  
32   - def test_exist_owner
33   - get :index
34   - assert_not_nil assigns(:owner)
35   - end
36   -
37 32 def test_should_generate_help_box_when_passing_string
38 33 get :help_with_string
39 34 assert_tag({
... ...
test/functional/features_controller_test.rb
... ... @@ -6,7 +6,7 @@ class FeaturesController; def rescue_action(e) raise e end; end
6 6  
7 7 class FeaturesControllerTest < Test::Unit::TestCase
8 8  
9   - fixtures :virtual_communities
  9 + fixtures :virtual_communities, :domains
10 10  
11 11 def setup
12 12 @controller = FeaturesController.new
... ...
test/integration/routing_test.rb
... ... @@ -25,7 +25,7 @@ class RoutingTest &lt; ActionController::IntegrationTest
25 25 #FIXME: assert_routing cannot find controllers in plugins'
26 26 flunk 'FIXME: assert_routing cannot find controllers in plugins'
27 27 require File.join(RAILS_ROOT, 'vendor', 'plugins', 'comatose', 'lib', 'comatose', 'admin_controller')
28   - assert_routing('/cms/ze', :controller => 'comatose::admin')
  28 + assert_routing('/cms/ze', :controller => 'comatose_admin')
29 29 end
30 30  
31 31 def test_edit_template
... ...
test/unit/organization_test.rb
1 1 require File.dirname(__FILE__) + '/../test_helper'
2 2  
3 3 class OrganizationTest < Test::Unit::TestCase
4   - fixtures :organizations
  4 + fixtures :profiles
5 5  
6   - # Replace this with your real tests.
  6 + # FIXME: add actual organization tests here
7 7 def test_truth
8   - assert true
  8 + assert_not_nil Organization.new
9 9 end
10 10 end
... ...