Sha256: c6fc282f0eb3279562df6de893cea64a94506e52aea97b9f2412853b1e63ed88

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

require File.expand_path("../test_helper", File.dirname(__FILE__))

class RakeTaskTest < ActiveSupport::TestCase
  include ActiveSupport::Testing::Isolation

  def setup
    require "rake"
    load "rails_erd/tasks.rake"

    RailsERD.options.file_type = :dot
    RailsERD.options.suppress_warnings = true
    Rake.application.options.silent = true
  end

  def teardown
    FileUtils.rm "ERD.dot" rescue nil
    RailsERD::Diagram.send :remove_const, :Graphviz rescue nil
  end
  
  # Diagram generation =======================================================
  test "generate task should create output based on domain model" do
    create_simple_domain
    Rake::Task["erd:generate"].execute
    assert File.exists?("ERD.dot")
  end

  test "generate task should not create output if there are no connected models" do
    Rake::Task["erd:generate"].execute rescue nil
    assert !File.exists?("ERD.dot")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-erd-0.2.0 test/unit/rake_task_test.rb