Sha256: 6427fb8ae05815c679290c8c19dc3855e86f8f6bba4565550e13f0655cc14e6b

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

require 'test_helper'
require 'tmpdir'
require 'rails/generators/test_case'
require 'generators/active_graph/devise_generator.rb'

class ActiveGraph::Generators::ModelGeneratorTest < Rails::Generators::TestCase
  tests ActiveGraph::Generators::DeviseGenerator
  destination File.join(Dir.tmpdir, File.dirname(__FILE__))
  setup :prepare_destination

  def assert_class(klass, content)
    assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}"
    yield $2.strip if block_given?
  end

  # test "invoke with model name" do
  #   content = run_generator %w(Player)

  #   assert_file "app/models/player.rb" do |player|
  #     assert_class "Player", player do |klass|
  #       assert_match /ActiveGraph::Node/, klass
  #     end
  #   end
  # end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-activegraph-3.0.0.alpha.1 test/generators/active_graph/devise_generator_test.rb