Commit 4258c807ecd6de056491280dcf74adb7d2b0dd02

Authored by David Silva
1 parent cdad6671

Unit tests.

Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
Signed-off-by: Dylan Guedes <djmgguedes@gmail.com>
app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -18,7 +18,6 @@ class ProfileEditorController &lt; MyProfileController
18 18 @profile_data = profile
19 19 @possible_domains = profile.possible_domains
20 20 if request.post?
21   - puts "$"*80, params[:profile_data]
22 21 params[:profile_data][:fields_privacy] ||= {} if profile.person? && params[:profile_data].is_a?(Hash)
23 22 Profile.transaction do
24 23 Image.transaction do
... ...
plugins/profile_description_block/test/unit/profile_description_block_test.rb 0 → 100644
... ... @@ -0,0 +1,29 @@
  1 +require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper")
  2 +
  3 +class ProfileDescriptionBlockTest < ActiveSupport::TestCase
  4 + def setup
  5 + e = Environment.default
  6 + e.enabled_plugins = ['ProfileDescriptionPlugin']
  7 + @person = create_user('test_user').person
  8 + @profile = Profile.create!(:identifier => '1236',
  9 + :name => 'blabla',
  10 + :description => "")
  11 + end
  12 +
  13 + should 'describe itself' do
  14 + assert_not_equal Block.description, ProfileDescriptionBlock.description
  15 + end
  16 +
  17 + should "show profile description inside block" do
  18 + new_block = ProfileDescriptionBlock.create!
  19 + @profile.boxes.first.blocks << new_block
  20 + block_menssage = "Description field are empty"
  21 + assert (instance_eval(&Block.last.content).include?(block_menssage)),
  22 + "description block doesn't show not found description message"
  23 + description = "This is an test"
  24 + @profile.update_attribute("description", description)
  25 + @profile.save!
  26 + assert (instance_eval(&Block.last.content).include?(description)),
  27 + "Description block doesn't show profile description"
  28 + end
  29 +end
... ...
plugins/profile_description_block/views/blocks/profile_description.html.erb
... ... @@ -3,6 +3,6 @@
3 3 <%= block.title %>
4 4 </div>
5 5 <div class = "profile-description-block-title">
6   - <%= description %>
  6 + <%= description %>
7 7 </div>
8 8 </div>
... ...
test/unit/article_block_test.rb
1 1 require_relative "../test_helper"
2 2  
3 3 class ArticleBlockTest < ActiveSupport::TestCase
4   -
5 4 include ApplicationHelper
6 5  
7 6 should 'describe itself' do
... ...