Sha256: f24b53b9b40559eb0ec69338cea77c3195bc1ac7361335392feeffb55ef73a45

Contents?: true

Size: 790 Bytes

Versions: 6

Compression:

Stored size: 790 Bytes

Contents

require "test_helper"
require "generators/roomer/model/model_generator"

class ModelGeneratorTest < Rails::Generators::TestCase
  tests Roomer::Generators::ModelGenerator 
  destination File.expand_path("../../tmp", __FILE__)
  setup :prepare_destination

  test "create class and migration for a tenanted model" do
    run_generator %w(foo bar:string)
    assert_file "app/models/foo.rb" do |model|
      assert_match /roomer :tenanted/, model
    end
    assert_migration "db/migrate/roomer_create_foos.rb"
  end

  test "create class and migration for shared model" do
    run_generator %w(foo bar:string --shared)
    assert_file "app/models/foo.rb" do |model|
      assert_match /roomer :shared/, model
    end
    assert_migration "db/migrate/global/roomer_create_foos.rb"
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roomer-1.0.1 test/generators/model_generator_test.rb
roomer-1.0.0 test/generators/model_generator_test.rb
roomer-0.0.11 test/generators/model_generator_test.rb
roomer-0.0.10 test/generators/model_generator_test.rb
roomer-0.0.9 test/generators/model_generator_test.rb
roomer-0.0.8 test/generators/model_generator_test.rb