[Git][noosfero/noosfero][master] 2 commits: application_controller: provide sample environment to avoid crashes

Rodrigo Souto gitlab at mg.gitlab.com
Tue Feb 2 18:39:20 BRST 2016


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
359f3aa8 by Rodrigo Souto at 2016-02-02T17:25:52-03:00
application_controller: provide sample environment to avoid crashes

This was previously done to avoid crashes on development environment,
but some selenium tests, for unknown reasons, produces requests where
Environment.default returns nil even though all steps passes.

- - - - -
d34432ad by Rodrigo Souto at 2016-02-02T17:30:46-03:00
media-panel-feature: fix folder creation test

- - - - -


2 changed files:

- app/controllers/application_controller.rb
- features/media_panel_upload_files.feature


Changes:

=====================================
app/controllers/application_controller.rb
=====================================
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -131,12 +131,11 @@ class ApplicationController < ActionController::Base
     @domain = Domain.find_by_name(request.host)
     if @domain.nil?
       @environment = Environment.default
-      if @environment.nil? && Rails.env.development?
-        # This should only happen in development ...
+      # Avoid crashes on test and development setups
+      if @environment.nil? && !Rails.env.production?
         @environment = Environment.new
         @environment.name = "Noosfero"
         @environment.is_default = true
-        @environment.save!
       end
     else
       @environment = @domain.environment


=====================================
features/media_panel_upload_files.feature
=====================================
--- a/features/media_panel_upload_files.feature
+++ b/features/media_panel_upload_files.feature
@@ -94,20 +94,17 @@ Feature: uploads items on media panel
 
   @selenium
   Scenario: select type when create new folder
-    When I follow "Show/Hide"
-      And I follow "New folder"
-      And I choose "Folder" within "#new-folder-dialog"
-      And I fill in "Name" with "Main new folder" within "#new-folder-dialog"
-      And I press "Create"
+    Given I follow "Show/Hide"
+    And I follow "New folder"
+    And I choose "Folder" within "#new-folder-dialog"
+    And I fill in "Name" with "Main new folder" within "#new-folder-dialog"
+    When I press "Create"
     Then I should see "joaosilva/Gallery/Main new folder" within "#parent_id"
-    When I follow "New folder"
-      And I choose "Gallery" within "#new-folder-dialog"
-      And I fill in "Name" with "Gallery new folder" within "#new-folder-dialog"
-      And I press "Create"
-      And I go to joaosilva's cms
-      And I follow "Gallery"
-    Then I should see "Folder" within "tr[title='Main new folder'] td.article-mime"
-      And I should see "Gallery" within "tr[title='Gallery new folder'] td.article-mime"
+    Given I follow "New folder"
+    And I choose "Gallery" within "#new-folder-dialog"
+    And I fill in "Name" with "Gallery new folder" within "#new-folder-dialog"
+    When I press "Create"
+    Then I should see "joaosilva/Gallery/Gallery new folder" within "#parent_id"
 
   @selenium
   Scenario: hide and show upload list



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/bbd28eeb0199469b4c0f2beaeb064839a8aa9172...d34432adf782fd6b9b61a81bb361d2c7fdb47878
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160202/5fff3dcc/attachment.html>


More information about the Noosfero-dev mailing list