Sha256: 454263e2e0b2bc77fa8493364903a42483186dc186a57627e1e10aa079f45012

Contents?: true

Size: 926 Bytes

Versions: 10

Compression:

Stored size: 926 Bytes

Contents

require 'spec_helper'

describe Lolita::Translation::Migrator do
  let(:klass) { Lolita::Translation::Migrator }

  before(:each) do
    c_class = Class.new(ActiveRecord::Base)
    stub_const('Comment',c_class)
    c_class.class_eval do
      include Lolita::Translation
      translate :body
    end
  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

10 entries across 10 versions & 1 rubygems

Version Path
lolita-translation-0.8.4 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.8.3 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.8.2 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.8.1 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.8.0 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.7.4 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.7.3 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.7.2 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.7.1 spec/lolita-translation/migrator_spec.rb
lolita-translation-0.7.0 spec/lolita-translation/migrator_spec.rb