iqvoc_skosxl 2.3.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +17 -7
  3. data/Gemfile.lock +200 -156
  4. data/README.md +8 -0
  5. data/app/assets/stylesheets/iqvoc_skosxl/{entity_select.css → entity_select.css.scss} +1 -1
  6. data/app/assets/stylesheets/iqvoc_skosxl/manifest.css.scss +1 -0
  7. data/app/assets/stylesheets/manifest.css.scss +3 -0
  8. data/app/controllers/labels/versions_controller.rb +33 -37
  9. data/app/controllers/labels_controller.rb +32 -31
  10. data/app/controllers/rdf_controller.rb +6 -7
  11. data/app/helpers/iqvoc_skosxl_helper.rb +2 -9
  12. data/app/helpers/labels_helper.rb +7 -9
  13. data/app/models/concept/skosxl/extension.rb +2 -4
  14. data/app/models/label/relation/base.rb +10 -12
  15. data/app/models/label/relation/skosxl/base.rb +5 -3
  16. data/app/models/label/skosxl/base.rb +44 -70
  17. data/app/models/label/skosxl/properties/literal_form.rb +23 -0
  18. data/app/models/label/skosxl/validations.rb +28 -0
  19. data/app/models/labeling/skosxl/alt_label.rb +0 -2
  20. data/app/models/labeling/skosxl/base.rb +22 -16
  21. data/app/models/labeling/skosxl/hidden_label.rb +1 -3
  22. data/app/models/labeling/skosxl/pref_label.rb +0 -2
  23. data/app/views/labels/_form.html.erb +12 -10
  24. data/app/views/labels/_sidebar.html.erb +1 -0
  25. data/app/views/labels/show_published.html.erb +2 -2
  26. data/app/views/labels/show_unpublished.html.erb +6 -6
  27. data/app/views/partials/label/relation/_edit_base.html.erb +1 -1
  28. data/app/views/partials/label/skosxl/_new_link_base.html.erb +5 -5
  29. data/app/views/partials/labeling/skosxl/_edit_base.html.erb +13 -13
  30. data/app/views/rdf/show_label.iqrdf +2 -2
  31. data/config/application.rb +4 -34
  32. data/config/boot.rb +3 -12
  33. data/config/engine.rb +2 -4
  34. data/config/environment.rb +3 -3
  35. data/config/initializers/backtrace_silencers.rb +7 -0
  36. data/config/initializers/cookies_serializer.rb +3 -0
  37. data/config/initializers/filter_parameter_logging.rb +4 -0
  38. data/config/initializers/inflections.rb +16 -0
  39. data/config/initializers/iqvoc.rb +49 -3
  40. data/config/initializers/mime_types.rb +4 -0
  41. data/config/initializers/session_store.rb +1 -1
  42. data/config/initializers/wrap_parameters.rb +14 -0
  43. data/config/routes.rb +16 -8
  44. data/config/secrets.yml +11 -0
  45. data/db/migrate/20110408121540_extend_label.rb +9 -12
  46. data/db/migrate/20110408123644_add_label_relations.rb +11 -13
  47. data/iqvoc_skosxl.gemspec +15 -14
  48. data/lib/iqvoc/skosxl/version.rb +1 -1
  49. data/lib/iqvoc/xllabel.rb +1 -5
  50. data/lib/iqvoc_skosxl.rb +13 -12
  51. data/test/{functional → controllers}/routing_test.rb +4 -6
  52. data/test/fixtures/hobbies.nt +11 -0
  53. data/test/integration/concept_label_language_test.rb +44 -45
  54. data/test/integration/dashboard_test.rb +10 -12
  55. data/test/integration/edit_labels_test.rb +12 -14
  56. data/test/integration/label_creation_test.rb +43 -0
  57. data/test/integration/labels_order_test.rb +17 -17
  58. data/test/integration_test_helper.rb +29 -0
  59. data/test/models/label_test.rb +54 -0
  60. data/test/models/skos_importer_test.rb +55 -0
  61. data/test/test_helper.rb +6 -12
  62. metadata +45 -24
  63. data/app/assets/stylesheets/iqvoc_skosxl/manifest.css +0 -3
  64. data/app/assets/stylesheets/manifest.css +0 -5
  65. data/config/initializers/secret_token.rb +0 -10
  66. data/config/initializers/secret_token.rb.template +0 -9
  67. data/test/factories.rb +0 -22
  68. data/test/unit/label_test.rb +0 -41
@@ -0,0 +1,43 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2014 innoQ Deutschland GmbH
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
+
19
+ class LabelCreationTest < ActionDispatch::IntegrationTest
20
+ setup do
21
+ login 'administrator'
22
+ end
23
+
24
+ test 'label creation' do
25
+ visit new_label_path(lang: 'de', language: 'de')
26
+ assert page.has_content? 'Neues Label'
27
+ fill_in 'Vorlageform', with: 'Testlabel'
28
+ click_link_or_button 'Speichern'
29
+ assert page.has_content? 'Das Label wurde erstellt.'
30
+ click_link_or_button 'Konsistenz prüfen'
31
+ assert page.has_content? 'Instanz ist konsistent.'
32
+ end
33
+
34
+ test 'inkonsistent label creation' do
35
+ visit new_label_path(lang: 'de', language: 'de')
36
+ assert page.has_content? 'Neues Label'
37
+ fill_in 'Vorlageform', with: ''
38
+ click_link_or_button 'Speichern'
39
+ assert page.has_content? 'Das Label wurde erstellt.'
40
+ click_link_or_button 'Konsistenz prüfen'
41
+ assert page.has_content? 'Instanz ist inkonsistent.'
42
+ end
43
+ end
@@ -14,30 +14,30 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require 'test_helper'
17
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
18
 
19
19
  class LabelsOrderTest < ActionDispatch::IntegrationTest
20
-
21
- test "label order is not case-sensitive" do
22
- names = ["aaa", "bbb", "abc", "ABC"]
23
- lang = "en"
20
+ test 'label order is not case-sensitive' do
21
+ names = ['aaa', 'bbb', 'abc', 'ABC']
22
+ lang = 'en'
24
23
  # create a few labels
25
- label_class = Iqvoc::Concept.labeling_classes.first.first.label_class
26
- names.each { |name|
27
- label = label_class.new(:origin => "_%s" % name, :value => name,
28
- :language => lang, :published_at => Time.now)
29
- label.save
30
- }
24
+ names.each_with_index do |name, index|
25
+ label = Label::SKOSXL::Base.create! do |l|
26
+ l.origin = "#{name}-#{index}"
27
+ l.value = name
28
+ l.language = lang
29
+ l.published_at = Time.now
30
+ end
31
+ end
31
32
  assert_equal names.length, Label::Base.all.count # just to avoid confusion
32
33
 
33
- get labels_path(:lang => lang, :format => "json")
34
+ get labels_path(lang: lang, format: 'json')
34
35
  data = JSON.parse(@response.body)
35
36
 
36
37
  assert_response :success
37
- assert_equal "aaa", data[0]["name"]
38
- assert_equal "abc", data[1]["name"]
39
- assert_equal "ABC", data[2]["name"] # XXX: do we care about order of "ABC" vs. "abc"?
40
- assert_equal "bbb", data[3]["name"]
38
+ assert_equal 'aaa', data[0]['name']
39
+ assert_equal 'abc', data[1]['name']
40
+ assert_equal 'ABC', data[2]['name'] # XXX: do we care about order of "ABC" vs. "abc"?
41
+ assert_equal 'bbb', data[3]['name']
41
42
  end
42
-
43
43
  end
@@ -0,0 +1,29 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2014 innoQ Deutschland GmbH
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ require File.expand_path('test_helper', File.dirname(__FILE__))
17
+ require 'capybara/rails'
18
+ require 'capybara/dsl'
19
+ require 'capybara/poltergeist'
20
+ require Iqvoc.root.join('test', 'authentication')
21
+
22
+ Capybara.javascript_driver = :poltergeist
23
+
24
+ module ActionDispatch
25
+ class IntegrationTest
26
+ include Capybara::DSL
27
+ include Authentication
28
+ end
29
+ end
@@ -0,0 +1,54 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
4
+
5
+ class LabelTest < ActiveSupport::TestCase
6
+ setup do
7
+ @user = User.create(
8
+ email: 'testuser@iqvoc.local',
9
+ forename: 'Test',
10
+ surname: 'Test',
11
+ password: 'test',
12
+ password_confirmation: 'test',
13
+ role: User.default_role,
14
+ active: true)
15
+ end
16
+
17
+ test 'should not create two similar labels' do
18
+ @current_label = Iqvoc::XLLabel.base_class.create(
19
+ language: 'en', value: 'Forest', published_at: 3.days.ago)
20
+ duplicate = Iqvoc::XLLabel.base_class.new(
21
+ language: 'en', value: 'Forest', published_at: 3.days.ago)
22
+ refute duplicate.save
23
+ duplicate.published_at = nil
24
+ assert duplicate.save
25
+ end
26
+
27
+ test 'language interpolation for label origin' do
28
+ @current_label = Iqvoc::XLLabel.base_class.create(
29
+ language: 'en', value: 'Forest', published_at: 3.days.ago)
30
+ assert_equal 'forest-en', @current_label.origin
31
+ end
32
+
33
+ test 'should create two labels with equal values but different languages' do
34
+ l1 = Iqvoc::XLLabel.base_class.create(
35
+ language: 'de', value: 'Forest', published_at: 3.days.ago)
36
+ l2 = Iqvoc::XLLabel.base_class.new(
37
+ language: 'en', value: 'Forest', published_at: 3.days.ago)
38
+ assert l2.save
39
+ assert_equal 'forest-en', l2.origin
40
+ end
41
+
42
+ test 'should validate origin for escaping' do
43
+ label = Iqvoc::XLLabel.base_class.new(
44
+ language: 'en', value: 'Forest', published_at: 3.days.ago)
45
+ assert label.publishable?
46
+
47
+ label.origin = 'FoÖ/Bär'
48
+ assert_equal 'foo-bar', label.origin
49
+ assert label.publishable?
50
+
51
+ label.origin = Iqvoc::Origin.new('FoÖ/Bär').to_s
52
+ assert label.publishable?
53
+ end
54
+ end
@@ -0,0 +1,55 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.expand_path('../../test_helper', __FILE__)
4
+ require 'iqvoc/skos_importer'
5
+
6
+ class SkosImporterTest < ActiveSupport::TestCase
7
+ TEST_DATA = File.open(File.expand_path('../../fixtures/hobbies.nt', __FILE__))
8
+
9
+ setup do
10
+ Iqvoc.rdf_namespaces['test'] = 'http://foo.bar/xl#'
11
+
12
+ class TestRelation < Label::Relation::SKOSXL::Base
13
+ self.rdf_namespace = 'test'
14
+ self.rdf_predicate = 'test-relation'
15
+ end
16
+
17
+ @importer = Iqvoc::SkosImporter.new(TEST_DATA, 'http://hobbies.com/')
18
+ @importer.second_level_object_classes << TestRelation
19
+ end
20
+
21
+ test 'imports xl labels with relations' do
22
+ assert_equal 0, Concept::SKOS::Base.count
23
+ assert_equal 0, Label::SKOSXL::Base.count
24
+
25
+ @importer.run
26
+
27
+ assert_equal 1, Labeling::SKOSXL::PrefLabel.count
28
+ assert_equal 1, Labeling::SKOSXL::AltLabel.count
29
+ assert_equal 2, Label::SKOSXL::Base.count
30
+ assert_equal 1, Concept::SKOS::Base.count
31
+
32
+ concept = Concept::SKOS::Base.published.first!
33
+ pref_label = Labeling::SKOSXL::PrefLabel.first!
34
+ alt_label = Labeling::SKOSXL::AltLabel.first!
35
+
36
+ assert concept.pref_label.published?
37
+ assert_equal 'computer_programming-xl-preflabel-en', concept.pref_label.origin
38
+ assert_equal 'Computer programming (used as xl:prefLabel)', concept.pref_label.value
39
+ assert_equal 'en', concept.pref_label.language
40
+ assert_equal 1, concept.pref_label.notes_for_class(Note::SKOS::Definition).count
41
+ assert_equal 'en', concept.pref_label.notes_for_class(Note::SKOS::Definition).first.language
42
+ assert_equal 'Bla bla bla', concept.pref_label.notes_for_class(Note::SKOS::Definition).first.value
43
+
44
+ assert_equal concept, alt_label.owner
45
+ assert alt_label.target.published?
46
+ assert_equal 'computer_programming-xl-altlabel-en', alt_label.target.origin
47
+ assert_equal 'Computer programming (used as xl:altLabel)', alt_label.target.value
48
+ assert_equal 'en', alt_label.target.language
49
+ assert_equal 1, alt_label.target.notes_for_class(Note::SKOS::Definition).count
50
+ assert_equal 'en', alt_label.target.notes_for_class(Note::SKOS::Definition).first.language
51
+ assert_equal 'Yadda yadda', alt_label.target.notes_for_class(Note::SKOS::Definition).first.value
52
+ assert_equal 1, alt_label.target.relations_for_class(TestRelation).count
53
+ assert_equal pref_label.target, alt_label.target.relations_for_class(TestRelation).first.range
54
+ end
55
+ end
data/test/test_helper.rb CHANGED
@@ -1,14 +1,8 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
- require 'factories'
5
-
6
- class ActiveSupport::TestCase
7
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
8
- #
9
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
10
- # -- they do not yet inherit this setting
11
- # fixtures :all
1
+ ENV['RAILS_ENV'] ||= 'test'
12
2
 
13
- # Add more helper methods to be used by all tests here...
3
+ # Load rails environment if not loaded
4
+ unless defined?(Iqvoc) && Iqvoc::SKOSXL.const_defined?(:Engine)
5
+ require File.expand_path('../../config/environment', __FILE__)
14
6
  end
7
+
8
+ require 'rails/test_help'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iqvoc_skosxl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Glaser
@@ -10,37 +10,44 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-02 00:00:00.000000000 Z
13
+ date: 2014-10-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: iqvoc
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: 4.5.0
19
22
  - - "~>"
20
23
  - !ruby/object:Gem::Version
21
- version: 4.3.0
24
+ version: '4.6'
22
25
  type: :runtime
23
26
  prerelease: false
24
27
  version_requirements: !ruby/object:Gem::Requirement
25
28
  requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 4.5.0
26
32
  - - "~>"
27
33
  - !ruby/object:Gem::Version
28
- version: 4.3.0
34
+ version: '4.6'
29
35
  - !ruby/object:Gem::Dependency
30
36
  name: bundler
31
37
  requirement: !ruby/object:Gem::Requirement
32
38
  requirements:
33
- - - ">="
39
+ - - "~>"
34
40
  - !ruby/object:Gem::Version
35
- version: '0'
36
- type: :runtime
41
+ version: '1.6'
42
+ type: :development
37
43
  prerelease: false
38
44
  version_requirements: !ruby/object:Gem::Requirement
39
45
  requirements:
40
- - - ">="
46
+ - - "~>"
41
47
  - !ruby/object:Gem::Version
42
- version: '0'
43
- description: ''
48
+ version: '1.6'
49
+ description: iQvoc - a SKOS(-XL) vocabulary management system built on the Semantic
50
+ Web
44
51
  email:
45
52
  - till.schulte-coerne@innoq.com
46
53
  executables: []
@@ -53,9 +60,9 @@ files:
53
60
  - Rakefile
54
61
  - app/assets/javascripts/iqvoc_skosxl/manifest.js
55
62
  - app/assets/javascripts/manifest.js
56
- - app/assets/stylesheets/iqvoc_skosxl/entity_select.css
57
- - app/assets/stylesheets/iqvoc_skosxl/manifest.css
58
- - app/assets/stylesheets/manifest.css
63
+ - app/assets/stylesheets/iqvoc_skosxl/entity_select.css.scss
64
+ - app/assets/stylesheets/iqvoc_skosxl/manifest.css.scss
65
+ - app/assets/stylesheets/manifest.css.scss
59
66
  - app/controllers/labels/versions_controller.rb
60
67
  - app/controllers/labels_controller.rb
61
68
  - app/controllers/rdf_controller.rb
@@ -65,6 +72,8 @@ files:
65
72
  - app/models/label/relation/base.rb
66
73
  - app/models/label/relation/skosxl/base.rb
67
74
  - app/models/label/skosxl/base.rb
75
+ - app/models/label/skosxl/properties/literal_form.rb
76
+ - app/models/label/skosxl/validations.rb
68
77
  - app/models/labeling/skosxl/alt_label.rb
69
78
  - app/models/labeling/skosxl/base.rb
70
79
  - app/models/labeling/skosxl/hidden_label.rb
@@ -98,16 +107,21 @@ files:
98
107
  - config/environments/development.rb
99
108
  - config/environments/production.rb
100
109
  - config/environments/test.rb
110
+ - config/initializers/backtrace_silencers.rb
111
+ - config/initializers/cookies_serializer.rb
112
+ - config/initializers/filter_parameter_logging.rb
113
+ - config/initializers/inflections.rb
101
114
  - config/initializers/iqvoc.rb
102
115
  - config/initializers/iqvoc_skosxl.rb
103
- - config/initializers/secret_token.rb
104
- - config/initializers/secret_token.rb.template
116
+ - config/initializers/mime_types.rb
105
117
  - config/initializers/session_store.rb
118
+ - config/initializers/wrap_parameters.rb
106
119
  - config/locales/activerecord.de.yml
107
120
  - config/locales/activerecord.en.yml
108
121
  - config/locales/de.yml
109
122
  - config/locales/en.yml
110
123
  - config/routes.rb
124
+ - config/secrets.yml
111
125
  - db/migrate/20110408121540_extend_label.rb
112
126
  - db/migrate/20110408123644_add_label_relations.rb
113
127
  - db/schema.rb
@@ -117,16 +131,20 @@ files:
117
131
  - lib/iqvoc/skosxl/version.rb
118
132
  - lib/iqvoc/xllabel.rb
119
133
  - lib/iqvoc_skosxl.rb
120
- - test/factories.rb
121
- - test/functional/routing_test.rb
134
+ - test/controllers/routing_test.rb
135
+ - test/fixtures/hobbies.nt
122
136
  - test/integration/concept_label_language_test.rb
123
137
  - test/integration/dashboard_test.rb
124
138
  - test/integration/edit_labels_test.rb
139
+ - test/integration/label_creation_test.rb
125
140
  - test/integration/labels_order_test.rb
141
+ - test/integration_test_helper.rb
142
+ - test/models/label_test.rb
143
+ - test/models/skos_importer_test.rb
126
144
  - test/test_helper.rb
127
- - test/unit/label_test.rb
128
- homepage: http://innoq.com
129
- licenses: []
145
+ homepage: http://iqvoc.net
146
+ licenses:
147
+ - Apache License 2.0
130
148
  metadata: {}
131
149
  post_install_message:
132
150
  rdoc_options: []
@@ -144,16 +162,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
162
  version: '0'
145
163
  requirements: []
146
164
  rubyforge_project:
147
- rubygems_version: 2.2.2
165
+ rubygems_version: 2.4.2
148
166
  signing_key:
149
167
  specification_version: 4
150
168
  summary: iQvoc SKOS-XL extension
151
169
  test_files:
152
- - test/factories.rb
153
- - test/functional/routing_test.rb
170
+ - test/controllers/routing_test.rb
171
+ - test/fixtures/hobbies.nt
154
172
  - test/integration/concept_label_language_test.rb
155
173
  - test/integration/dashboard_test.rb
156
174
  - test/integration/edit_labels_test.rb
175
+ - test/integration/label_creation_test.rb
157
176
  - test/integration/labels_order_test.rb
177
+ - test/integration_test_helper.rb
178
+ - test/models/label_test.rb
179
+ - test/models/skos_importer_test.rb
158
180
  - test/test_helper.rb
159
- - test/unit/label_test.rb
@@ -1,3 +0,0 @@
1
- /*
2
- *= require iqvoc_skosxl/entity_select
3
- */
@@ -1,5 +0,0 @@
1
- /*
2
- *= require framework
3
- *= require iqvoc/manifest
4
- *= require iqvoc_skosxl/manifest
5
- */
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- if Iqvoc::SKOSXL.const_defined?(:Application)
8
- Iqvoc::SKOSXL::Application.config.secret_token = '1cf4863673a83d39f30e77670978adaa9009fc27e6869066c67157ef6790c4b79a4eb4c32029987a3444483b73cb01606291c272a32d6201c06f4ca75dcd5b14'
9
- Iqvoc::SKOSXL::Application.config.secret_key_base = '1cf4863673a83d39f30e77670978adaa9009fc27e6869066c67157ef6790c4b79a4eb4c32029987a3444483b73cb01606291c272a32d6201c06f4ca75dcd5b14'
10
- end
@@ -1,9 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- if Iqvoc::SKOSXL.const_defined?(:Application)
8
- Iqvoc::SKOSXL::Application.config.secret_key_base = '1cf4863673a83d39f30e77670978adaa9009fc27e6869066c67157ef6790c4b79a4eb4c32029987a3444483b73cb01606291c272a32d6201c06f4ca75dcd5b14'
9
- end
data/test/factories.rb DELETED
@@ -1,22 +0,0 @@
1
- FactoryGirl.define do
2
-
3
- factory :xllabel, :class => Iqvoc::XLLabel.base_class do |l|
4
- l.language 'en'
5
- l.value 'Forest'
6
- l.published_at 3.days.ago
7
- end
8
-
9
- factory :xllabel_with_association, :parent => :xllabel do |l|
10
- end
11
-
12
- factory :user do |u|
13
- u.forename 'Test'
14
- u.surname 'User'
15
- u.email 'testuser@iqvoc.local'
16
- u.password 'omgomgomg'
17
- u.password_confirmation 'omgomgomg'
18
- u.role 'reader'
19
- u.active true
20
- end
21
-
22
- end
@@ -1,41 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'test_helper'
4
-
5
- class LabelTest < ActiveSupport::TestCase
6
-
7
- setup do
8
- @current_label = FactoryGirl.create(:xllabel_with_association)
9
- @user = FactoryGirl.create(:user)
10
- end
11
-
12
- test "should not create two similar labels" do
13
- first_new_label = Label::SKOSXL::Base.new(@current_label.attributes)
14
- second_new_label = Label::SKOSXL::Base.new(@current_label.attributes)
15
- assert first_new_label.save
16
- assert_equal false, second_new_label.save
17
- end
18
-
19
- test "language interpolation for label origin" do
20
- assert_equal "Forest-en", @current_label.origin
21
- end
22
-
23
- test "should create two labels with equal values but different languages" do
24
- l1 = FactoryGirl.create(:xllabel, :language => "de")
25
- l2 = FactoryGirl.build(:xllabel, :language => "en")
26
- assert_equal true, l2.save
27
- assert_equal "Forest-en", l2.origin
28
- end
29
-
30
- test "should validate origin for escaping" do
31
- label = FactoryGirl.build(:xllabel)
32
- assert label.valid_with_full_validation?
33
-
34
- label.origin = "FoÖ/Bär"
35
- assert label.invalid_with_full_validation?
36
-
37
- label.origin = Iqvoc::Origin.new("FoÖ/Bär").to_s
38
- assert label.valid_with_full_validation?
39
- end
40
-
41
- end