<commit_before># require File.dirname(__FILE__) + '/spec_helper.rb'
#
# #require 'rubygems'; require 'ruby-debug'
#
# describe "A migration" do
#
#   before do
#     @migration = ProductMigration.new
#     @legacy_model = mock("ar_object1", :null_object => true)
#     @active_model = mock("ar_object2", :null_object => true)
#     @legacy_model.stub!(:name).and_return("Beer")
#     @active_model.stub!(:name=).and_return("Beer")
#     Product.stub!(:new).and_return(@active_model)
#     Legacy::Product.stub!(:count).and_return(1)
#     Legacy::Product.stub!(:find).and_return([@legacy_model])
#   end
#
#   it "should call #before_run" do
#     @migration.should_receive(:before_run)
#     @migration.run
#   end
#
#   it "should call #before_migrate_record" do
#     @migration.should_receive(:before_migrate_record)
#     @migration.run
#   end
#
#   it "should call #before_migrate_field" do
#     @migration.should_receive(:before_migrate_field)
#     @migration.run
#   end
#
#   it "should call #after_migrate_field" do
#     @migration.should_receive(:after_migrate_field)
#     @migration.run
#   end
#
#   it "should call #after_migrate_record" do
#     @migration.should_receive(:after_migrate_record)
#     @migration.run
#   end
#
#   it "should call #after_run" do
#     @migration.should_receive(:after_run)
#     @migration.run
#   end
#
# end
<commit_msg>callbacks spec refactored<commit_after>require File.dirname(__FILE__) + '/spec_helper.rb'

require File.dirname(__FILE__) + '/fixtures/product_one_migration'

describe "A migration" do

  before do
    @legacy_record = mock('legacy_model', :id => 1, :name => 'Beer')
    @active_record = mock('active_model', :name= => 'Beer', :save => true)
    Product.stub!(:new).and_return(@active_record)
    Legacy::Product.stub!(:count).and_return(1)
    Legacy::Product.stub!(:find).and_return([@legacy_record])
    @migration = ProductOneMigration.new
  end

  it "should call #before_run" do
    @migration.should_receive(:before_run).once
    @migration.run
  end

  it "should call #before_migrate_record" do
    @migration.should_receive(:before_migrate_record).once
    @migration.run
  end

  it "should call #before_migrate_field" do
    @migration.should_receive(:before_migrate_field).once
    @migration.run
  end

  it "should call #after_migrate_field" do
    @migration.should_receive(:after_migrate_field).once
    @migration.run
  end

  it "should call #after_migrate_record" do
    @migration.should_receive(:after_migrate_record).once
    @migration.run
  end

  it "should call #after_run" do
    @migration.should_receive(:after_run).once
    @migration.run
  end

end
{'fraction_non_alphanumeric': 0.13602110022607386, 'fraction_numerical': 0.0018839487565938207, 'mean_word_length': 4.331325301204819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5794673', 'n_tokens_mistral': 959, 'n_tokens_neox': 962, 'n_words': 160}