diff --git a/controllers/gov_user_plugin_controller.rb b/controllers/gov_user_plugin_controller.rb index cecddaa..a85a6df 100644 --- a/controllers/gov_user_plugin_controller.rb +++ b/controllers/gov_user_plugin_controller.rb @@ -123,6 +123,15 @@ class GovUserPluginController < ApplicationController protected + def get_model_by_params_field + case params[:field] + when "software_language" + return ProgrammingLanguage + else + return DatabaseDescription + end + end + def get_state_list NationalRegion.find( :all, diff --git a/features/steps_definitions/gov_user_steps.rb b/features/steps_definitions/gov_user_steps.rb index 78bf984..62f2b6c 100644 --- a/features/steps_definitions/gov_user_steps.rb +++ b/features/steps_definitions/gov_user_steps.rb @@ -44,7 +44,6 @@ page.driver.browser.execute_script %Q{ sleep 1 end - Given /^the following public institutions?$/ do |table| # table is a Cucumber::Ast::Table table.hashes.each do |item| @@ -66,3 +65,26 @@ Given /^the following public institutions?$/ do |table| institution.save! end end + + +Given /^I sleep for (\d+) seconds$/ do |time| + sleep time.to_i +end + +Given /^I am logged in as mpog_admin$/ do + visit('/account/logout') + + user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') + person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" + user.person = person + user.save! + + user.activate + e = Environment.default + e.add_admin(user.person) + + visit('/account/login') + fill_in("Username", :with => user.login) + fill_in("Password", :with => '123456') + click_button("Log in") +end \ No newline at end of file diff --git a/test/functional/gov_user_plugin_controller_test.rb b/test/functional/gov_user_plugin_controller_test.rb index 60a4066..d4d7d6b 100644 --- a/test/functional/gov_user_plugin_controller_test.rb +++ b/test/functional/gov_user_plugin_controller_test.rb @@ -190,9 +190,12 @@ class GovUserPluginControllerTest < ActionController::TestCase ) fields[:institutions][:acronym] = "SPI" + fields[:action] = "new_institution" + fields[:controller] ="gov_user_plugin" + post :new_institution, fields - assert_redirected_to(controller: "software_communities_plugin", action: "create_institution_admin") + assert_redirected_to(controller: "gov_user_plugin", action: "create_institution_admin", params: fields) end should "Create foreign institution without city, state and cnpj by post" do diff --git a/test/helpers/plugin_test_helper.rb b/test/helpers/plugin_test_helper.rb index e83a713..741cb2f 100644 --- a/test/helpers/plugin_test_helper.rb +++ b/test/helpers/plugin_test_helper.rb @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../helpers/institution_test_helper' module PluginTestHelper - def create_person name, email, password, password_confirmation, secondary_email, state, city + def create_person name, email, password, password_confirmation, secondary_email, state="state", city="city" user = create_user( name.to_slug, email, -- libgit2 0.21.2