Sha256: 35af53cdbbc00fb54af31649fd66a89d469244857ce9013dbfcb4cc7e4c75908

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'schema_dev/gemfiles'

describe SchemaDev::Gemfiles do

  it "copies listed files" do
    config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[4.0 4.1], db: %W[sqlite3 postgresql])
    in_tmpdir do
      expect(SchemaDev::Gemfiles.build(config)).to be_truthy
      expect(relevant_diff(config, "gemfiles")).to be_empty
    end
  end

  it "only copies files once" do
    config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[4.0 4.1], db: %W[sqlite3 postgresql])
    in_tmpdir do
      expect(SchemaDev::Gemfiles.build(config)).to be_truthy
      expect(SchemaDev::Gemfiles.build(config)).to be_falsey
    end
  end

  def relevant_diff(config, dir)
    src = SchemaDev::Templates.root + dir
    diff = `diff -rq #{src} #{dir} 2>&1`.split("\n")

    # expect copy not to have entry for activerecord not in config
    diff.reject!{ |d| d =~ %r[Only in #{src}: activerecord-(.*)] and not config.activerecord.include? $1 }

    # expect copy not to have entry for db not in config
    diff.reject!{ |d| d =~ %r[Only in #{src}.*: Gemfile.(.*)] and not config.db.include? $1 }
  end

end


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
schema_dev-3.5.1 spec/gemfiles_spec.rb
schema_dev-3.5.0 spec/gemfiles_spec.rb
schema_dev-3.4.0 spec/gemfiles_spec.rb
schema_dev-3.3.0 spec/gemfiles_spec.rb
schema_dev-3.2.4 spec/gemfiles_spec.rb
schema_dev-3.2.3 spec/gemfiles_spec.rb