Actualizar plugin Glossary a 1.1.0

This commit is contained in:
Manuel Cillero 2020-11-22 21:35:04 +01:00
parent 24560c8598
commit b9e569d03f
103 changed files with 954 additions and 2967 deletions

View file

@ -0,0 +1,10 @@
color:
id: 1
name: Color
project_id: 1
shape:
id: 2
name: Shape
project_id: 1

View file

@ -1,19 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
show_desc:
gropby:
project_scope: 1
sort_item_0: MyString
sort_item_1: MyString
sort_item_2: MyString
user_id: 1
two:
id: 2
show_desc:
gropby:
project_scope: 1
sort_item_0: MyString
sort_item_1: MyString
sort_item_2: MyString
user_id: 1

View file

@ -0,0 +1,31 @@
red:
id: 1
project_id: 1
category_id: 1
name: red
green:
id: 2
project_id: 1
category_id: 1
name: green
created_at: 2018-08-08 18:18:18
updated_at: 2018-08-08 18:18:18
blue:
id: 3
project_id: 2
category_id: 1
name: blue
created_at: 2018-08-08 18:18:18
updated_at: 2018-08-08 18:18:18
clear:
id: 4
project_id: 1
name: clear
created_at: 2018-08-08 18:18:18
updated_at: 2018-08-08 18:18:18

View file

@ -1,19 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
show_desc:
gropby:
project_scope: 1
sort_item_0: MyString
sort_item_1: MyString
sort_item_2: MyString
user_id: 1
two:
id: 2
show_desc:
gropby:
project_scope: 1
sort_item_0: MyString
sort_item_1: MyString
sort_item_2: MyString
user_id: 1

View file

@ -1,11 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
project_id: 1
name: MyString
position: 1
two:
id: 2
project_id: 1
name: MyString
position: 1

View file

@ -1,17 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
show_desc:
categorized:
all_project:
search_str:
search_category:
sort_items: MyString
two:
id: 2
show_desc:
categorized:
all_project:
search_str:
search_category:
sort_items: MyString

View file

@ -1,25 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
project_id:
category_id:
author_id:
updater_id:
name:
name_en:
codename:
description:
created_on:
updated_on: 2010-12-13 21:25:16
two:
id: 2
project_id:
category_id:
author_id:
updater_id:
name:
name_en:
codename:
description:
created_on:
updated_on: 2010-12-13 21:25:16

View file

@ -1,19 +0,0 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
show_desc:
gropby:
project_scope: 1
sort_item_0: MyString
sort_item_1: MyString
sort_item_2: MyString
user_id: 1
two:
id: 2
show_desc:
gropby:
project_scope: 1
sort_item_0: MyString
sort_item_1: MyString
sort_item_2: MyString
user_id: 1

View file

@ -0,0 +1,57 @@
require File.expand_path('../../test_helper', __FILE__)
class GlossaryCategoriesControllerTest < ActionController::TestCase
fixtures :projects, :users, :roles, :members, :member_roles
plugin_fixtures :glossary_categories
def setup
@project = projects('projects_001')
@project.enabled_module_names = [:glossary]
roles('roles_001').add_permission! :view_glossary, :manage_glossary
end
def test_index
@request.session[:user_id] = users('users_002').id
get :index, params: {project_id: 1}
assert_response :success
end
def test_edit
@request.session[:user_id] = users('users_002').id
get :edit, params: {id: 1, project_id: 1}
assert_response :success
assert_select 'form', true
end
def test_update
@request.session[:user_id] = users('users_002').id
patch :update, params: {id: 1, project_id: 1, glossary_category: {name: 'Colour'}}
category = GlossaryCategory.find(1)
assert_redirected_to project_glossary_category_path(@project, category)
assert_equal 'Colour', category.name
end
def test_new
@request.session[:user_id] = users('users_002').id
get :new, params: {id: 1, project_id: 1}
assert_response :success
assert_select 'form', true
end
def test_create
@request.session[:user_id] = users('users_002').id
post :create, params: {
project_id: 1, glossary_category: {name: 'Material'}
}
category = GlossaryCategory.find_by(name: 'Material')
assert_not_nil category
assert_redirected_to project_glossary_category_path(@project, category)
end
def test_destroy
@request.session[:user_id] = users('users_002').id
delete :destroy, params: { id: 1, project_id: 1 }
assert_raise(ActiveRecord::RecordNotFound) { GlossaryCategory.find(1) }
assert_redirected_to project_glossary_categories_path(@project)
end
end

View file

@ -1,8 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class GlossaryControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,8 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class GlossaryStylesControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -0,0 +1,59 @@
require File.expand_path('../../test_helper', __FILE__)
class GlossaryTermsControllerTest < ActionController::TestCase
fixtures :projects, :users, :roles, :members, :member_roles
plugin_fixtures :glossary_terms
def setup
@project = projects('projects_001')
@project.enabled_module_names = [:glossary]
roles('roles_001').add_permission! :view_glossary, :manage_glossary
end
def test_index
@request.session[:user_id] = users('users_002').id
get :index, params: {project_id: 1}
assert_response :success
end
def test_edit
@request.session[:user_id] = users('users_002').id
get :edit, params: {id: 1, project_id: 1}
assert_response :success
assert_select 'form', true
end
def test_update
@request.session[:user_id] = users('users_002').id
patch :update, params: {id: 1, project_id: 1, glossary_term: {
name: 'rosso'
}}
term = GlossaryTerm.find(1)
assert_redirected_to project_glossary_term_path(@project, term)
assert_equal 'rosso', term.name
end
def test_new
@request.session[:user_id] = users('users_002').id
get :new, params: {project_id: 1}
assert_response :success
assert_select 'form', true
end
def test_create
@request.session[:user_id] = users('users_002').id
post :create, params: { project_id: 1, glossary_term: {
name: 'white', category_id: 1
}}
term = GlossaryTerm.find_by(name: 'white')
assert_not_nil term
assert_redirected_to project_glossary_term_path(@project, term)
end
def test_destroy
@request.session[:user_id] = users('users_002').id
delete :destroy, params: {id: 1, project_id: 1}
assert_raise(ActiveRecord::RecordNotFound) { GlossaryTerm.find(1) }
assert_redirected_to project_glossary_terms_path(@project)
end
end

View file

@ -1,8 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class GlossrayStylesControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,8 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class TermCategoriesControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,8 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class TermQueriesControllerTest < ActionController::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,5 +1,29 @@
# Load the normal Rails helper
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
# Load the Redmine helper
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
# Ensure that we are using the temporary fixture path
Engines::Testing.set_fixture_path
module Redmine
module PluginFixturesLoader
def self.included(base)
base.class_eval do
def self.plugin_fixtures(*symbols)
ActiveRecord::FixtureSet.create_fixtures(File.dirname(__FILE__) + '/fixtures/', symbols)
end
end
end
end
end
## functional test
unless ActionController::TestCase.included_modules.include?(Redmine::PluginFixturesLoader)
ActionController::TestCase.send :include, Redmine::PluginFixturesLoader
end
## unit test
unless ActiveSupport::TestCase.included_modules.include?(Redmine::PluginFixturesLoader)
ActiveSupport::TestCase.send :include, Redmine::PluginFixturesLoader
end
## integration test
unless Redmine::IntegrationTest.included_modules.include?(Redmine::PluginFixturesLoader)
Redmine::IntegrationTest.send :include, Redmine::PluginFixturesLoader
end

View file

@ -0,0 +1,15 @@
# coding: utf-8
require File.expand_path('../../test_helper', __FILE__)
class GlossaryCategoryTest < ActiveSupport::TestCase
fixtures :glossary_categories
plugin_fixtures :glossary_categories
def setup
@category = glossary_categories('color')
end
def test_valid
assert @category.valid?
end
end

View file

@ -1,10 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class GlossaryStyleTest < ActiveSupport::TestCase
fixtures :glossary_styles
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -0,0 +1,21 @@
require File.expand_path('../../test_helper', __FILE__)
class GlossaryTermTest < ActiveSupport::TestCase
fixtures :glossary_terms
plugin_fixtures :glossary_terms
def setup
@term = glossary_terms('red')
end
def test_valid
assert @term.valid?
end
def test_invalid_without_name
@term.name = nil
assert_raises ActiveRecord::NotNullViolation do
@term.save
end
end
end

View file

@ -1,10 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class GrossaryStyleTest < ActiveSupport::TestCase
fixtures :grossary_styles
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,10 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class TermCategoryTest < ActiveSupport::TestCase
fixtures :term_categories
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,10 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class TermQueryTest < ActiveSupport::TestCase
fixtures :term_queries
# Replace this with your real tests.
def test_truth
assert true
end
end

View file

@ -1,10 +0,0 @@
require File.dirname(__FILE__) + '/../test_helper'
class TermTest < ActiveSupport::TestCase
fixtures :terms
# Replace this with your real tests.
def test_truth
assert true
end
end