Sha256: 6fd6eba442741cc9f4c2e79121b80234456b361de60ac459f499e7f66cfafea1

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

require 'spec_helper'

describe Railsless::ActiveRecord::SeedLoader do
  let(:seed_path) { fixture('seeds.rb') }
  let(:bad_seed_path) { fixture('doesnt_exist.rb') }
  before { stub_const('BlogPost', double) }

  it "loads a seed file that exists" do
    loader = Railsless::ActiveRecord::SeedLoader.new(seed_path)
    expect(BlogPost).to receive(:create).with(:title => "Example")
    loader.load_seed
  end

  it "ignores non-existent seeds" do
    [bad_seed_path, nil].each do |path|
      loader = Railsless::ActiveRecord::SeedLoader.new(path)
      expect(BlogPost).to_not receive(:create)
      expect(loader.load_seed).to be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsless-active_record-0.0.2 spec/active_record/seed_loader_spec.rb
railsless-active_record-0.0.1 spec/active_record/seed_loader_spec.rb