Sha256: 190893351f0278df4274cd95534b33dfc1b5243df05cfee76b6aa212937b0248

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../helper')

describe "AccountModelGenerator" do
  def setup
    @apptmp = "#{Dir.tmpdir}/padrino-tests/#{UUID.new.generate}"
    `mkdir -p #{@apptmp}`
  end

  def teardown
    `rm -rf #{@apptmp}`
  end

  # COUCHREST
  context 'account model using couchrest' do
    setup do
      capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=couchrest') }
      capture_io { generate(:admin_app,"-a=/admin", "--root=#{@apptmp}/sample_project") }

      @model = "#{@apptmp}/sample_project/admin/models/account.rb"
    end

    should 'be a couchrest model instance' do
      assert_match_in_file(/class Account < CouchRest::Model::Base/m, @model)
    end

    should 'not require additional validations' do
      assert_no_match_in_file(/include CouchRest::Validation/m, @model)
    end

    should 'no longer have validates_with_method' do
      assert_no_match_in_file(/validates_with_method/m, @model)
    end

    should 'validate report errors using ActiveModel errors method' do
      assert_match_in_file(/errors\.add\(:email, "is not unique"\)/m, @model)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
padrino-admin-0.10.7 test/generators/test_account_model_generator.rb
padrino-admin-0.10.6 test/generators/test_account_model_generator.rb
padrino-admin-0.10.6.e test/generators/test_account_model_generator.rb
padrino-admin-0.10.6.d test/generators/test_account_model_generator.rb
padrino-admin-0.10.6.c test/generators/test_account_model_generator.rb
padrino-admin-0.10.6.b test/generators/test_account_model_generator.rb
padrino-admin-0.10.6.a test/generators/test_account_model_generator.rb
padrino-admin-0.10.5 test/generators/test_account_model_generator.rb
padrino-admin-0.10.4 test/generators/test_account_model_generator.rb
padrino-admin-0.10.3 test/generators/test_account_model_generator.rb