Sha256: f7ba7764266c55da518ce4f3788e5fb4b6e8bd9307a43965230c645baaf4e043

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

# encoding: UTF-8

# Copyright 2011 innoQ Deutschland GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')

class LabelsOrderTest < ActionDispatch::IntegrationTest
  test 'label order is not case-sensitive' do
    names = ['aaa', 'bbb', 'abc', 'ABC']
    lang = 'en'
    # create a few labels
    names.each_with_index do |name, index|
      label = Label::SKOSXL::Base.create! do |l|
        l.origin = "#{name}-#{index}"
        l.value = name
        l.language = lang
        l.published_at = Time.now
      end
    end
    assert_equal names.length, Label::Base.all.count # just to avoid confusion

    get labels_path(lang: lang, format: 'json')
    data = JSON.parse(@response.body)

    assert_response :success
    assert_equal 'aaa (en)', data[0]['name'] # hacky test fix "(en)" will be injected by javascript widget
    assert_equal 'abc (en)', data[1]['name']
    assert_equal 'ABC (en)', data[2]['name'] # XXX: do we care about order of "ABC" vs. "abc"?
    assert_equal 'bbb (en)', data[3]['name']
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iqvoc_skosxl-2.9.1 test/integration/labels_order_test.rb
iqvoc_skosxl-2.9.0 test/integration/labels_order_test.rb
iqvoc_skosxl-2.8.1 test/integration/labels_order_test.rb
iqvoc_skosxl-2.8.0 test/integration/labels_order_test.rb