File: translation_repository_spec.rb

package info (click to toggle)
ruby-fast-gettext 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 720 kB
  • ctags: 301
  • sloc: ruby: 3,092; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require "spec_helper"

module FastGettext
  module TranslationRepository
    class Dummy
      attr_accessor :name, :options
      def initialize(name, options)
        @name = name
        @options = options
      end
    end
  end
end

describe FastGettext::TranslationRepository do
  describe "build" do
    it "auto requires class by default" do
      lambda { FastGettext::TranslationRepository.build('xx', { :type => 'invalid'}) }.should raise_error(LoadError)
    end

    it "can have auto-require disabled" do
      FastGettext::TranslationRepository.build('xx', { :type => 'dummy' })
    end

    it "makes a new repository" do
      options = { :type => 'dummy', :external => true }
      repo = FastGettext::TranslationRepository.build('xx', options)
      repo.class.should == FastGettext::TranslationRepository::Dummy
      repo.name.should == 'xx'
      repo.options.should == options
    end
  end
end