Sha256: 0d466ee8323069384c0b8b7e8eaeab0c757e1e0034d892b0b05563f613fde366

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require File.expand_path("lib/lolita-translation/orm/mixin")
require File.expand_path("lib/lolita-translation/errors")

describe Lolita::Translation::ORM do  
  let(:klass){ Class.new }

  before(:each) do 
    klass.extend(Lolita::Translation::ORM::ClassMethods)
    klass.class_eval do 
      include Lolita::Translation::ORM::InstanceMethods
    end
  end

  context "ClassMethods" do 

    it "should provide #translate method to class" do 
      klass.should respond_to(:translate)
    end

    it "should provide #translations_configuration for class" do 
      klass.should respond_to(:translations_configuration)
    end 

    it "should raise error when configuration is requested before its initialization" do 
      expect{
        klass.translations_configuration
      }.to raise_error(Lolita::Translation::ConfigurationNotInitializedError)
    end 

    it "should provide #sync_translation_table!" do 
      klass.should respond_to(:sync_translation_table!)
    end  
  end

  context "InstanceMethods" do 
    it "should provide #translation_record to all instances of class" do 
      obj = klass.new
      obj.should respond_to(:translation_record)
    end 

    it "should provide #original_locale" do 
      obj = klass.new
      obj.should respond_to(:original_locale)
    end

    it "should provide #original_locale=" do 
      obj = klass.new
      obj.should respond_to(:original_locale=)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lolita-translation-0.8.4 spec/lolita-translation/orm/mixin_spec.rb
lolita-translation-0.8.3 spec/lolita-translation/orm/mixin_spec.rb
lolita-translation-0.8.2 spec/lolita-translation/orm/mixin_spec.rb
lolita-translation-0.8.1 spec/lolita-translation/orm/mixin_spec.rb
lolita-translation-0.8.0 spec/lolita-translation/orm/mixin_spec.rb
lolita-translation-0.7.4 spec/lolita-translation/orm/mixin_spec.rb