klastera 1.5.2.5 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. metadata +9 -81
  3. data/MIT-LICENSE +0 -20
  4. data/README.rdoc +0 -3
  5. data/Rakefile +0 -37
  6. data/app/assets/javascripts/klastera/application.js +0 -13
  7. data/app/assets/javascripts/klastera/clusters.js +0 -2
  8. data/app/assets/stylesheets/klastera/clusters.scss +0 -46
  9. data/app/controllers/klastera/application_controller.rb +0 -29
  10. data/app/controllers/klastera/clusters_controller.rb +0 -60
  11. data/app/helpers/klastera/application_helper.rb +0 -40
  12. data/app/models/klastera/cluster.rb +0 -5
  13. data/app/models/klastera/cluster_entity.rb +0 -5
  14. data/app/models/klastera/cluster_filter.rb +0 -5
  15. data/app/models/klastera/cluster_user.rb +0 -5
  16. data/app/models/klastera/concerns/cluster.rb +0 -67
  17. data/app/models/klastera/concerns/cluster_entity.rb +0 -18
  18. data/app/models/klastera/concerns/cluster_filter.rb +0 -22
  19. data/app/models/klastera/concerns/cluster_user.rb +0 -41
  20. data/app/models/klastera/concerns/clusterizable.rb +0 -57
  21. data/app/models/klastera/concerns/organization.rb +0 -49
  22. data/app/models/klastera/concerns/transfer.rb +0 -45
  23. data/app/models/klastera/concerns/user.rb +0 -77
  24. data/app/models/klastera/transfer.rb +0 -5
  25. data/app/views/klastera/clusters/_filter.html.erb +0 -0
  26. data/app/views/klastera/clusters/_form.html.erb +0 -22
  27. data/app/views/klastera/clusters/_form_transfer.html.erb +0 -34
  28. data/app/views/klastera/clusters/_table.html.erb +0 -33
  29. data/app/views/klastera/clusters/create.js.erb +0 -1
  30. data/app/views/klastera/clusters/destroy.js.erb +0 -6
  31. data/app/views/klastera/clusters/edit.html.erb +0 -10
  32. data/app/views/klastera/clusters/index.html.erb +0 -21
  33. data/app/views/klastera/clusters/new.html.erb +0 -10
  34. data/app/views/klastera/clusters/transfer.html.erb +0 -10
  35. data/app/views/klastera/clusters/update.js.erb +0 -1
  36. data/app/views/layouts/klastera/_cluster_entity_fields.html.erb +0 -10
  37. data/app/views/layouts/klastera/_cluster_filter.html.erb +0 -23
  38. data/app/views/layouts/klastera/_cluster_role.html.erb +0 -48
  39. data/app/views/layouts/klastera/_cluster_selector.html.erb +0 -21
  40. data/app/views/layouts/klastera/_cluster_user_fields.html.erb +0 -10
  41. data/app/views/layouts/klastera/_nested_cluster_entity.html.erb +0 -43
  42. data/app/views/layouts/klastera/_nested_cluster_user.html.erb +0 -22
  43. data/app/views/layouts/klastera/_options.html.erb +0 -21
  44. data/config/locales/es.yml +0 -96
  45. data/config/routes.rb +0 -7
  46. data/db/migrate/20200324203929_create_klastera_clusters.rb +0 -12
  47. data/db/migrate/20200326111219_add_cluster_options_to_organizations.rb +0 -6
  48. data/db/migrate/20200330010551_create_klastera_cluster_users.rb +0 -9
  49. data/db/migrate/20200330221601_add_order_field_to_clusters.rb +0 -5
  50. data/db/migrate/20200518142609_create_klastera_cluster_entities.rb +0 -8
  51. data/db/migrate/20200908180057_add_cluster_config_to_organization.rb +0 -5
  52. data/db/migrate/20220602222332_add_unique_index_to_cluster_entities.rb +0 -5
  53. data/db/migrate/20250429110829_add_entity_id_index_to_cluster_entities.rb +0 -6
  54. data/db/migrate/20250429110830_add_entity_id_index_and_entity_type_index_to_cluster_entities.klastera.rb +0 -7
  55. data/lib/klastera/engine.rb +0 -5
  56. data/lib/klastera/version.rb +0 -3
  57. data/lib/klastera.rb +0 -236
  58. data/lib/tasks/klastera_tasks.rake +0 -32
  59. data/test/controllers/klastera/clusters_controller_test.rb +0 -52
  60. data/test/fixtures/klastera/cluster_users.yml +0 -9
  61. data/test/fixtures/klastera/clusters.yml +0 -11
  62. data/test/integration/navigation_test.rb +0 -8
  63. data/test/klastera_test.rb +0 -7
  64. data/test/models/klastera/cluster_test.rb +0 -9
  65. data/test/models/klastera/cluster_user_test.rb +0 -9
  66. data/test/test_helper.rb +0 -21
@@ -1,96 +0,0 @@
1
- es:
2
- klastera:
3
- without_cluster: Sin cluster
4
- cluster:
5
- title: Cluster
6
- id: Cluster ID
7
- user:
8
- add_cluster: Agregar cluster
9
- you_need_add_at_least_one_cluster: Esta organización usa clusters en modo obligatorio. Asigne un cluster al usuario por favor.
10
- assign_cluster_role: Asignar role
11
- cluster_root_asignation:
12
- title: Asignación Super Admin
13
- text: Este rol es sólo para usuarios super admin
14
- roles:
15
- root: Super Admin
16
- admin: Admin Cluster
17
- user: Usuario Cluster
18
- using_cluster_as: Usando cluster como
19
- cluster_order: Orden
20
- cluster_id: ID
21
- cluster_role: Rol de clusters
22
- cluster_name: Nombre
23
- cluster_nid: Código
24
- cluster_color: Color
25
- organization_name: Organización
26
- use_cluster_as: Activar y usar cluster en modo
27
- required_suborganization: Obligatorio
28
- optional_suborganization: Opcional
29
- clusters:
30
- all: Todos
31
- title: Clusters
32
- siblings: Seleccione un cluster
33
- cant_delete: No se puede eliminar
34
- wrong_option: "%{value} es una opción inválida"
35
- entities: "[agregar entidades]"
36
- index:
37
- title: Gestión de clusters
38
- new:
39
- title: Nuevo Cluster
40
- edit:
41
- title: Editar Cluster %{cluster_nid}
42
- destroy:
43
- title: Eliminar Cluster %{cluster_nid}
44
- transfer:
45
- title: Eliminar Cluster %{cluster_nid}
46
- required: Para eliminar el Cluster es necesario asignar las entidades asociadas a un nuevo Cluster
47
- optional: Entidades asociadas al Cluster pueden quedar sin asignar o ser asignadas a un nuevo Cluster
48
- actions:
49
- filter: Filtrar
50
- cancel: Cancelar
51
- add: Agregar
52
- delete: Eliminar
53
- create: Crear
54
- update: Actualizar
55
- deleted: Eliminado
56
- created: Creado
57
- updated: Actualizado
58
- messages:
59
- has_one_cluster_entity: Está permitido agregar un sólo cluster
60
- at_least_one_cluster_entity: Debe agregar al menos un cluster
61
- record_action_successfully: Registro %{a} exitosamente
62
- cant_delete_the_last_record_in_required_suborganization_mode: No se puede eliminar el único cluster de esta organización
63
- duplicated_cluster_entity: Hay un cluster duplicado
64
- new_cluster_id:
65
- nil: Cluster no existe
66
- same: Cluster no puede ser el mismo
67
- current_cluster:
68
- cant_transfer: No se puede eliminar ni mover el cluster
69
- access_cluster_admin: No puede acceder a esta página
70
- help:
71
- popover:
72
- title: Descripción de cada opción
73
- content:
74
- user_as_cluster_as: "<ul class='klastera-option-help'><li>%{m1}</li><li>%{m2}</li></ul>"
75
- required_suborganization: "<b>%{t}</b>: Obliga asignar un cluster a las entidades %{e} ."
76
- optional_suborganization: "<b>%{t}</b>: Permite asociar un cluster a las entidades %{e}."
77
- roles:
78
- description: "<b>%{r}</b>: %{d}."
79
- root: Ve todos los clusters y no necesita asignación
80
- admin: Ve todos los clusters y no necesita asignación
81
- user:
82
- new: Usuario al que se le puede restringir la cosas que puede ver a través de su asignación con los clusters
83
- required: Necesita que se le asigne uno o más clusters, de lo contrario no verá las entidades clusterizadas.
84
- optional: Si no tiene clusters asignados verá todas la entidades CON y SIN clusters. Si se le asigna un cluster, verá las entidades de ese cluster + las entidades SIN cluster.
85
- activemodel:
86
- attributes:
87
- 'klastera/transfer':
88
- new_cluster_id: Cluster a transferir
89
- activerecord:
90
- models:
91
- 'klastera/cluster':
92
- one: Cluster
93
- other: Clusters
94
- attributes:
95
- organization:
96
- use_cluster_as: Activar y usar cluster como
data/config/routes.rb DELETED
@@ -1,7 +0,0 @@
1
- Klastera::Engine.routes.draw do
2
- resources :clusters, except: [:show] do
3
- member do
4
- get :transfer
5
- end
6
- end
7
- end
@@ -1,12 +0,0 @@
1
- class CreateKlasteraClusters < ActiveRecord::Migration
2
- def change
3
- create_table :clusters do |t|
4
- t.references :organization
5
- t.text :name
6
- t.string :nid
7
- t.string :color
8
-
9
- t.timestamps null: false
10
- end
11
- end
12
- end
@@ -1,6 +0,0 @@
1
- class AddClusterOptionsToOrganizations < ActiveRecord::Migration
2
- def change
3
- add_column :organizations, :use_cluster_as, :string
4
- add_index :organizations, :use_cluster_as, using: :btree
5
- end
6
- end
@@ -1,9 +0,0 @@
1
- class CreateKlasteraClusterUsers < ActiveRecord::Migration
2
- def change
3
- create_table :cluster_users do |t|
4
- t.integer :user_id, null: false
5
- t.integer :cluster_id, null: false
6
- end
7
- add_column :users, :cluster_role, :string
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- class AddOrderFieldToClusters < ActiveRecord::Migration
2
- def change
3
- add_column :clusters, :order, :integer
4
- end
5
- end
@@ -1,8 +0,0 @@
1
- class CreateKlasteraClusterEntities < ActiveRecord::Migration
2
- def change
3
- create_table :cluster_entities do |t|
4
- t.integer :cluster_id, index: true
5
- t.references :entity, polymorphic: true, index: true
6
- end
7
- end
8
- end
@@ -1,5 +0,0 @@
1
- class AddClusterConfigToOrganization < ActiveRecord::Migration
2
- def change
3
- add_column :organizations, :cluster_config, :text
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddUniqueIndexToClusterEntities < ActiveRecord::Migration[5.2]
2
- def change
3
- add_index :cluster_entities, %i[cluster_id entity_id entity_type], unique: true, name: :index_on_cluster_id_and_entity_id_and_entity_type
4
- end
5
- end
@@ -1,6 +0,0 @@
1
- class AddEntityIdIndexToClusterEntities < ActiveRecord::Migration[5.2]
2
- disable_ddl_transaction!
3
- def change
4
- add_index :cluster_entities, :entity_id, algorithm: :concurrently
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- # This migration comes from klastera (originally 20250429110947)
2
- class AddEntityIdIndexAndEntityTypeIndexToClusterEntities < ActiveRecord::Migration[5.2]
3
- disable_ddl_transaction!
4
- def change
5
- add_index :cluster_entities, [:entity_id,:entity_type], algorithm: :concurrently
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- module Klastera
2
- class Engine < ::Rails::Engine
3
- isolate_namespace Klastera
4
- end
5
- end
@@ -1,3 +0,0 @@
1
- module Klastera
2
- VERSION = "1.5.2.5"
3
- end
data/lib/klastera.rb DELETED
@@ -1,236 +0,0 @@
1
- require "klastera/engine"
2
-
3
- module Klastera
4
- mattr_accessor :organization_class
5
-
6
- extend ActiveSupport::Concern
7
-
8
- UNCLUSTERED_POSITION = 9999
9
- UNCLUSTERED_ENTITY = 'without_cluster'.freeze
10
- KLSTR_HELPERS = %i[ cluster_user cluster_organization cluster_list cluster_scope cluster_scope_through_of user_clusters_string_list cluster_scope_left_join ].freeze
11
-
12
- class << self
13
-
14
- ##
15
- # TODO:
16
- # Implement a validation to ensure that
17
- # object is a ActiveRecord::Base class
18
- # (or just try to guess how to retrieve the argument class)
19
- #
20
- ##
21
- def scope_class(object)
22
- object
23
- end
24
-
25
- ##
26
- # Returns which clusters a user can see avoiding unnecessary queries if the cluster restraint doesn't apply
27
- #
28
- def cluster_list!(organization,user,include_unclustered=true)
29
- # Only the cluster mode on and the mandatory user-cluster relation will use a join clause to get the clusters list
30
- if organization.is_in_cluster_mode? && user.cannot_skip_cluster_clause?
31
- active_record_collection = ::ClusterUser.clusters_of(organization,user)
32
- else
33
- active_record_collection = ::Cluster.where({ organization_id: organization }).order(order: :asc)
34
- end
35
-
36
- active_record_collection = active_record_collection.order(order: :asc)
37
-
38
- if include_unclustered && organization.optional_suborganization_mode? # For show and use modes only
39
- active_record_collection.to_a.append(
40
- ::Cluster.new({nid: UNCLUSTERED_ENTITY, name: I18n.t("klastera.#{UNCLUSTERED_ENTITY}"), order: UNCLUSTERED_POSITION })
41
- )
42
- end
43
- active_record_collection
44
- end
45
-
46
- ##
47
- # Return a string with cluster attribute separated by separator argument
48
- # A array of cluster ids can be passed fo filter the result
49
- #
50
- def entity_clusters_string_list!(cluster_entities,separator,attribute=:name,allowed_cluster_ids=nil)
51
- _cluster_entities = cluster_entities.reject(&:nil?)
52
- if allowed_cluster_ids.is_a?(Array)
53
- _cluster_entities.select!{|ce| allowed_cluster_ids.include?(ce.cluster_id)}
54
- end
55
- _cluster_entities.map do |ce|
56
- ce.cluster.try(attribute)
57
- end.compact.sort.join(separator)
58
- end
59
-
60
- ##
61
- # cluster_list! needs a user and a organization. that why we perfomed this logic here
62
- #
63
- def user_clusters_string_list!(user,organization,cluster_entities,separator,attribute=:name)
64
- @clusters_session ||= Klastera.cluster_list!(organization,user)
65
- self.entity_clusters_string_list!(cluster_entities, separator, attribute, @clusters_session.map(&:id))
66
- end
67
-
68
- #
69
- # We will try to avoid cluster clause except when:
70
- # 1.- cluster mode is active
71
- # AND
72
- # 2a.- cluster_filter is present (someone wants to filter by cluster)
73
- # OR
74
- # 2b.- the current user has some limitations and must checks they cluster relation
75
- # - User is having clusters in optional_suborganization mode
76
- # - User IS NOT having clusters in required_suborganization mode
77
- #
78
- # For the other hand, with force_cluster_clause we can skip the previous logic if
79
- # cluster_filter_id is present when the optional_suborganization mode is on. BUT!
80
- # Be aware that if the cluster_filter is not present, the value of force_cluster_clause
81
- # will be overridden by the returned value of cannot_skip_cluster_clause? method.
82
- def should_clusterize_scope?(user, organization, cluster_filter=nil, force_cluster_clause=false)
83
- should = false # I don't know if this is a good idea
84
- if organization.is_in_cluster_mode? && ( cluster_filter.present? || force_cluster_clause = user.cannot_skip_cluster_clause? ) # yes, this is an assignation
85
- cluster_ids = []
86
- # Set another variable as array to get the cluster id(s)
87
- if cluster_filter.present?
88
- cluster_ids = cluster_filter.is_a?(Array) ? cluster_filter : [cluster_filter]
89
- elsif force_cluster_clause
90
- cluster_ids = ::ClusterUser.clusters_of(organization,user).map(&:id)
91
- end
92
- # We will avoid the query unless cluster_ids is having values OR force_cluster_clause is set (see method description)
93
- if cluster_ids.present? || force_cluster_clause
94
- # We add the unclustered if the value of cluster_filter have the special without_cluster string or as method description says
95
- if cluster_ids.delete(UNCLUSTERED_ENTITY) || ( force_cluster_clause && organization.optional_suborganization_mode? )
96
- cluster_ids << nil
97
- end
98
- should = true
99
- end
100
- end
101
- yield(should,cluster_ids)
102
- end
103
-
104
- #
105
- # The cleanest and fast way to clusterize a entity!
106
- #
107
- def cluster_scope!(scope_klass, user, organization, cluster_filter=nil, force_cluster_clause=false)
108
- scope = scope_class(scope_klass)
109
- should_clusterize_scope?(user,organization,cluster_filter,force_cluster_clause) do |should,cluster_ids|
110
- if should
111
- scope = scope.eager_load(:organization,cluster_entities: :cluster).where( cluster_entities: { cluster_id: cluster_ids } )
112
- end
113
- end
114
- scope.where(organization_id: organization)
115
- end
116
-
117
-
118
- # Filter non-clustered entity through a clusterized one
119
- #
120
- def cluster_scope_through_of!(relation, cluster_entity_klass, scope_klass, user, organization, cluster_filter=nil, force_cluster_clause=false)
121
- unclusterized_scope = scope_class(scope_klass)
122
-
123
- if organization.is_in_cluster_mode? && ( force_cluster_clause || user.cannot_skip_cluster_clause? )
124
- unclusterized_scope = unclusterized_scope.joins(relation).joins(Klastera::ClusterEntity.left_join_sources_of(cluster_entity_klass))
125
- end
126
-
127
- if scope_klass.respond_to?(:organization)
128
- unclusterized_scope = unclusterized_scope.where(organization_id: organization)
129
- end
130
-
131
- unclusterized_scope.where("#{relation}_id" => cluster_scope!(cluster_entity_klass, user, organization, cluster_filter, force_cluster_clause))
132
- end
133
-
134
- #
135
- # Returns an array with a clusterized scoped result and its grouped version
136
- #
137
- def group_by_cluster_scope!(scope_klass, user, organization, cluster_filter=[], scope_scopes=[])
138
- cluster_ids = cluster_filter.is_a?(Array) ? cluster_filter : [cluster_filter]
139
- kluster_scope = cluster_scope!(scope_klass, user, organization, cluster_ids.compact, organization.is_in_cluster_mode? )
140
-
141
- scope_scopes.each do |tuple_scope|
142
- scope_name, scope_arg = tuple_scope
143
- kluster_scope = scope_arg.present? ? kluster_scope.send(scope_name,scope_arg) : kluster_scope.send(scope_name)
144
- end
145
-
146
- group_by_block = ->(o) {
147
- if organization.is_in_cluster_mode?
148
- o.cluster.present? ? o.cluster.name : UNCLUSTERED_POSITION
149
- else
150
- I18n.t("klastera.group_by_cluster_scope.#{scope_klass.model_name.plural}")
151
- end
152
- }
153
-
154
- grouped_cluster_scope = kluster_scope.group_by(&group_by_block).sort_by{|k,v|k.to_s}
155
-
156
- grouped_cluster_scope.dup.each do |group|
157
- if group.first == UNCLUSTERED_POSITION
158
- grouped_cluster_scope.delete(group)
159
- group[0] = I18n.t("klastera.#{UNCLUSTERED_ENTITY}")
160
- grouped_cluster_scope.append(group)
161
- end
162
- end
163
-
164
- [ kluster_scope, grouped_cluster_scope ]
165
- end
166
-
167
- #
168
- # A helper that returns a CLUSTER SCOPE to build queries that need explicit LEFT OUTER JOIN clause,
169
- # instead of the default INNER JOIN provide by ActiveRecord's joins method
170
- #
171
- def cluster_scope_left_join!(scope_klass,organization)
172
- cluster_entities_arel_table = Klastera::ClusterEntity.arel_table
173
- cluster_arel_table = ::Cluster.arel_table
174
- cluster_entities_cluster = cluster_entities_arel_table.join(cluster_arel_table, Arel::Nodes::OuterJoin).on(
175
- cluster_entities_arel_table[:cluster_id].eq(cluster_arel_table[:id]),
176
- ).join_sources
177
-
178
- scope_class(scope_klass).where(organization_id: organization).joins(Klastera::ClusterEntity.left_join_sources_of(scope_klass)).joins(cluster_entities_cluster)
179
- end
180
- end
181
-
182
- ##################################################################################################################################################
183
-
184
- def cluster_user
185
- current_user
186
- end
187
-
188
- def cluster_organization
189
- current_organization
190
- end
191
-
192
- def set_cluster_filter
193
- cluster_filter_params = params.require(:cluster_filter) rescue {}
194
- @cluster_filter = ::ClusterFilter.new(
195
- cluster_filter_params.present? ? cluster_filter_params.permit(
196
- [ :cluster_id ].concat( ::ClusterFilter.attributes )
197
- ) : {}
198
- )
199
- end
200
-
201
- def cluster_list(include_unclustered=true)
202
- Klastera.cluster_list!(cluster_organization, cluster_user, include_unclustered)
203
- end
204
-
205
- def cluster_scope(scope_klass, cluster_filter=nil, force_cluster_clause=false)
206
- Klastera.cluster_scope!(scope_klass, cluster_user, cluster_organization, cluster_filter, force_cluster_clause)
207
- end
208
-
209
- def cluster_scope_through_of(relation, cluster_entity_klass, scope_klass, cluster_filter=nil, force_cluster_clause=false)
210
- Klastera.cluster_scope_through_of!(relation, cluster_entity_klass, scope_klass, cluster_user, cluster_organization, cluster_filter, force_cluster_clause)
211
- end
212
-
213
- def group_by_cluster_scope(scope_klass, cluster_filter=[], scope_scopes=[])
214
- Klastera.group_by_cluster_scope!(scope_klass, cluster_user, cluster_organization, cluster_filter, scope_scopes)
215
- end
216
-
217
- def user_clusters_string_list(object_entity, separator, attribute=:name)
218
- Klastera.user_clusters_string_list!(cluster_user, cluster_organization, object_entity.try(:cluster_entities), separator, attribute)
219
- end
220
-
221
- def cluster_scope_left_join(scope_klass)
222
- Klastera.cluster_scope_left_join!(scope_klas,cluster_organization)
223
- end
224
-
225
- included do
226
- Klastera::KLSTR_HELPERS.each do |action|
227
- if respond_to?(:helper_method)
228
- helper_method(action)
229
- end
230
- if respond_to?(:hide_action)
231
- hide_action(helper)
232
- hide_action("#{helper}=")
233
- end
234
- end
235
- end
236
- end
@@ -1,32 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :klastera do
3
- # # Task goes here
4
- # end
5
-
6
-
7
- namespace :klastera do
8
- namespace :seed do
9
-
10
- desc "Move cluster_id to cluster_entities"
11
- task :cluster_entities, [:entity] => :environment do |task,args|
12
- begin
13
- klass = args.entity.constantize
14
- ActiveRecord::Base.transaction do
15
- klass.where.not(cluster_id: nil).each do |entity|
16
- if entity.cluster.blank?
17
- puts "Cluster ID #{entity.cluster_id} was not found!"
18
- puts "skip..."
19
- next
20
- end
21
- Klastera::ClusterEntity.create(entity: entity, cluster: entity.cluster)
22
- end
23
- end
24
- rescue NameError => ne
25
- puts "NameError Exception: #{ne}"
26
- rescue ActiveRecord::StatementInvalid => asi
27
- puts "ActiveRecord::StatementInvalid Exception #{asi}"
28
- end
29
- end
30
-
31
- end
32
- end
@@ -1,52 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Klastera
4
- class ClustersControllerTest < ActionController::TestCase
5
- setup do
6
- @cluster = klastera_clusters(:one)
7
- @routes = Engine.routes
8
- end
9
-
10
- test "should get index" do
11
- get :index
12
- assert_response :success
13
- assert_not_nil assigns(:clusters)
14
- end
15
-
16
- test "should get new" do
17
- get :new
18
- assert_response :success
19
- end
20
-
21
- test "should create cluster" do
22
- assert_difference('Cluster.count') do
23
- post :create, cluster: { color: @cluster.color, name: @cluster.name, nid: @cluster.nid }
24
- end
25
-
26
- assert_redirected_to cluster_path(assigns(:cluster))
27
- end
28
-
29
- test "should show cluster" do
30
- get :show, id: @cluster
31
- assert_response :success
32
- end
33
-
34
- test "should get edit" do
35
- get :edit, id: @cluster
36
- assert_response :success
37
- end
38
-
39
- test "should update cluster" do
40
- patch :update, id: @cluster, cluster: { color: @cluster.color, name: @cluster.name, nid: @cluster.nid }
41
- assert_redirected_to cluster_path(assigns(:cluster))
42
- end
43
-
44
- test "should destroy cluster" do
45
- assert_difference('Cluster.count', -1) do
46
- delete :destroy, id: @cluster
47
- end
48
-
49
- assert_redirected_to clusters_path
50
- end
51
- end
52
- end
@@ -1,9 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
-
3
- one:
4
- user_id: 1
5
- cluster_id: MyString
6
-
7
- two:
8
- user_id: 1
9
- cluster_id: MyString
@@ -1,11 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
-
3
- one:
4
- nid: MyString
5
- name: MyText
6
- color: MyString
7
-
8
- two:
9
- nid: MyString
10
- name: MyText
11
- color: MyString
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class NavigationTest < ActionDispatch::IntegrationTest
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
8
-
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class KlasteraTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, Klastera
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Klastera
4
- class ClusterTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Klastera
4
- class ClusterUserTest < ActiveSupport::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
data/test/test_helper.rb DELETED
@@ -1,21 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
5
- ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
6
- ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
7
- require "rails/test_help"
8
-
9
- # Filter out Minitest backtrace while allowing backtrace from other libraries
10
- # to be shown.
11
- Minitest.backtrace_filter = Minitest::BacktraceFilter.new
12
-
13
- # Load support files
14
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
-
16
- # Load fixtures from the engine
17
- if ActiveSupport::TestCase.respond_to?(:fixture_path=)
18
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
19
- ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
20
- ActiveSupport::TestCase.fixtures :all
21
- end