Sha256: 216d512d04b173a0c4c3a1c9b6c659881f23a438eb139f68c2eb577d973dba92

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

require 'test_helper'
require 'sfkb/settings'

describe SFKB::Settings do
  let(:subject) { klass.new }
  let(:klass) { Class.new(Minitest::Mock) { include SFKB::Settings } }

  let(:index) { Minitest::Mock.new('index') } 
  let(:languages) { %w(zh ja en).map { |l| OpenStruct.new(name: l, active: l != 'ja') } }
  let(:knowledgeManagement) { Minitest::Mock.new('knowledgeManagement') }
  let(:settings) { OpenStruct.new(defaultLanguage: 'en', languages: languages) }
    
  before do
    subject.expect :index, index
    index.expect :knowledgeManagement, knowledgeManagement
    knowledgeManagement.expect :settings, settings
  end

  it 'knows its default language' do
    assert_equal 'en', subject.defaultLanguage
  end

  it 'knows its languages' do
    assert_equal languages, subject.languages
  end

  it 'knows its active languages' do
    assert_equal %w(zh en), subject.active_languages
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sfkb-0.1.3 test/sfkb/settings_test.rb
sfkb-0.1.2 test/sfkb/settings_test.rb
sfkb-0.1.0 test/sfkb/settings_test.rb