Sha256: 49f7c9f1a62a25c4b1799f948d6003816484ae66ce18aaed6e820d81a87489ed

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Lolita::Translation::Migrator do 
  let(:klass) { Lolita::Translation::Migrator }
  
  before(:each) do 
    Object.send(:remove_const,:Comment) rescue nil
    c_class = Class.new(ActiveRecord::Base)
    Object.const_set(:Comment,c_class)
    c_class.class_eval do 
      include Lolita::Translation
      translate :body
    end
  end

  after(:each) do 
    Object.send(:remove_const,:Comment) rescue nil
  end

  describe "Instance methods" do 

    it "should have klass and config attributes" do 
      migrator = klass.new(Comment)
      migrator.klass.should eq(Comment)
      migrator.config.should eq(Comment.translations_configuration)
    end

    it "should raise error when #migrate called" do 
      migrator = klass.new(Comment)
      expect{
        migrator.migrate
      }.to raise_error(StandardError)
    end
  end

  describe "Class methods" do 
    it "should create concrete migrator for AR" do 
      klass.create(Comment).should be_kind_of(Lolita::Translation::Migrators::ActiveRecordMigrator)
    end
  end

end 

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lolita-translation-0.6.3 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.6.2 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.6.1 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.6.0 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.5.0 spec/lolita-translation/migrator_spec.rb