Sha256: b3a2ced027cbe6f3af5fdc8d19933214862d9bed99e5bc50e4a229fc4d25fb76

Contents?: true

Size: 717 Bytes

Versions: 44

Compression:

Stored size: 717 Bytes

Contents

require_relative '../test_helper'

class <%= class_name %>Test < ActiveSupport::TestCase

  def test_fixtures_validity
    <%= class_name %>.all.each do |<%= file_name %>|
      assert <%= file_name %>.valid?, <%= file_name %>.errors.inspect
    end
  end

  def test_validation
    <%= file_name %> = <%= class_name %>.new
    assert <%= file_name %>.invalid?
    assert_equal [<%= model_attrs.collect{|attr| ":#{attr.name}"}.join(', ')%>], <%= file_name %>.errors.keys
  end

  def test_creation
    assert_difference '<%= class_name %>.count' do
      <%= class_name %>.create(
      <%- model_attrs.each do |attr| -%>
        <%= attr.name %>: 'test <%= attr.name %>',
      <%- end -%>
      )
    end
  end
end

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
occams-1.1.0 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.8 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.7.3 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.7.2 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.7.1 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.7 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.6.1 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.6 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.5 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.4 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.3 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.2 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.1 lib/generators/occams/scaffold/templates/tests/model.rb.tt
occams-1.0.0 lib/generators/occams/scaffold/templates/tests/model.rb.tt
comfortable_mexican_sofa-2.0.19 lib/generators/comfy/scaffold/templates/tests/model.rb.tt
PixelForce_ETS-0.0.2 lib/generators/comfy/scaffold/templates/tests/model.rb.tt
PixelForce_ETS-0.0.1 lib/generators/comfy/scaffold/templates/tests/model.rb.tt
kcyEtsTest2-0.0.4 lib/generators/comfy/scaffold/templates/tests/model.rb.tt
kcyEtsTest2-0.0.3 lib/generators/comfy/scaffold/templates/tests/model.rb.tt
kcyEtsTest2-0.0.2 lib/generators/comfy/scaffold/templates/tests/model.rb.tt