Sha256: 30c4d1648cdee0c45f259777cf32fc5c829670ed92d453e69f588a6e74b23c19

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'

class TestGenerator
  include RailsAssist::Migration
end

RailsAssist::Migration.orm = :active_record

describe RailsAssist::Migration do
  let(:dir) { fixtures_dir }  
  let(:generator) { TestGenerator.new }  

  before :each do              
  end

  after :each do
  end

  describe '#migration_lookup_at' do
    it "should return 4 migrations" do    
      generator.class.migration_lookup_at(dir).should have(4).items
    end
  end

  describe '#migration_exists?' do
    it "should verify migration 'a' exists" do    
      generator.class.migration_exists?(dir, 'migration_a').should include('001_migration_a.rb') 
    end

    it "should verify migration 'c' exists" do          
      generator.class.migration_exists?(dir, 'migration_c').should include('004_migration_c.rb') 
    end
  end

  describe '#first_migration_file' do
    it "should find first migration 'a'" do    
      generator.class.first_migration_file(dir, 'migration_a').should include('001_migration_a.rb')       
    end
  end

  describe '#latest_migration_file' do
    it "should lookup latest migration 'a' " do    
      generator.class.latest_migration_file(dir, 'migration_a').should include('003_migration_a.rb')             
    end

    it "should lookup latest migration 'b' " do          
      generator.class.latest_migration_file(dir, 'migration_b').should include('002_migration_b.rb')       
    end
  end

  describe '#current_migration_number' do
    it "should find current migration number 4" do    
      generator.class.current_migration_number(dir).should be 4
    end
  end

  describe '#next_migration_number' do    
    it "should find next migration number > 4" do               
      generator.class.next_migration_number(dir).to_i.should be > 4      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
migration_assist-0.4.0 spec/migration_assist/class_methods_spec.rb
migration_assist-0.3.1 spec/migration_assist/class_methods_spec.rb
migration_assist-0.3.0 spec/migration_assist/class_methods_spec.rb
migration_assist-0.2.0 spec/migration_assist/class_methods_spec.rb