Commit Graph

95 Commits

Author SHA1 Message Date
Jon Leighton
ff7ab3bc78 Automatically maintain test database schema
* Move check from generated helper to test_help.rb, so that all
  applications can benefit
* Rather than just raising when the test schema has pending migrations,
  try to load in the schema and only raise if there are pending
  migrations afterwards
* Opt out of the check by setting
  config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
  for maintaining the test schema, so we don't need rake tasks for this.
  This is also a speed improvement since we're no longer reloading the
  test database on every call to "rake test".
2014-01-02 13:49:00 +00:00
Rafael Mendonça França
02d366842c Adding missing require 2014-01-02 00:52:47 -02:00
schneems
9749e0efbf Move default production database to URL sub key
By using the URL sub key in the `database.yml` by default we are exposing the ability to set other attributes such as `pool` or `reap_frequency` without need of modifying the URL to contain non-connection specific information.
2014-01-01 17:48:24 -05:00
schneems
d0926d3d5e fix 2.1.0 bug :( 2013-12-25 18:27:09 -05:00
schneems
707be603cf ensure environment is run before db:structure:load
Right now `db:drop` depends on `load_config` since so when `db:drop` gets executed `load_config` gets run. `db:structure:load` depends on `[:environment, :load_config]`. So before it runs, it executes `environment` but because `load_config` has already executed it is skipped. Note `db:load_config` is "invoke"-d twice, but only "execute"-d once:

```
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:structure:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config
** Execute db:structure:load
```

The fix for this is making sure that the environment is run before any `load_config`:

```
** Invoke environment (first_time)
** Execute environment
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:structure:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:structure:load
```
2013-12-25 18:03:55 -05:00
schneems
ba882934bb Partial fix of database url tests
Prior to #13463 when `DATABASE_URL` was set, Rails automagically used that value instead of the database.yml. There are tests in dbs_test that expect this to still be true. After that PR, `RAILS_DATABASE_URL` is expected to be read into the YAML file via ERB, this PR fixes that behavior.

Note: this does not entirely fix the tests. It seems that `ActiveRecord::Tasks::DatabaseTasks.current_config` does not process the url string correctly (convert it into a hash), and ` ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename)` as well as other methods in `DatabaseTasks` expect a hash.

It seems like we should involve the resolver somewhere in this process to correctly convert the database url, I do not know the best place for that /cc @josevalim
2013-12-25 18:03:55 -05:00
Kuldeep Aggarwal
b9d79b1f5f using symbol instead of string in establish_connection 2013-12-25 15:24:25 +05:30
schneems
dd93a5f459 Use Full path to sqlite database in tests 2013-12-22 00:56:59 -05:00
Kuldeep Aggarwal
4b7fee029f added test cases to find notes in a file with .builder extension 2013-11-17 15:33:02 +05:30
Arun Agrawal
c10a78124c More Warnings removed for ruby trunk
Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
2013-11-01 13:47:23 +01:00
Yves Senn
5c6e11d6b8 fix build error caused by #11900. 2013-08-15 14:17:08 +02:00
Josh Crowder
f3073773a3 Adding LESS to rake notes 2013-08-15 11:30:01 +01:00
Yuri Artemev
dd996ad394 handle notes in *.sass files 2013-07-08 19:13:01 +04:00
José Valim
dd5a80dc3d Remove hard coded references to Active Record in railties 2013-03-02 13:52:32 -07:00
Terence Lee
e3f5d023ff run the load_structure test in the test environment 2013-02-21 01:25:05 +11:00
Terence Lee
44298c39e4 test DATABASE_URL without database.yml around 2013-02-21 01:25:05 +11:00
Brian D. Burns
5a9b3b7a74 allow :dirs option for .enumerate
Allows custom rake tasks to be defined using:

  SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
2013-01-15 14:14:05 -05:00
Jeremy Kemper
009873aec8 Introduce ./bin for your app's executables: bin/bundle, bin/rails, bin/rake. Executable scripts are versioned code like the rest of your app. To generate a stub for a bundled gem: 'bundle binstubs unicorn' and 'git add bin/unicorn' 2013-01-06 21:41:36 -07:00
Marc-Andre Lafortune
a4932d6a63 Fixes for PR [#8267]
* Fix Migration#reversible by not using `transaction`.

* Adapt mysql adapter to updated api for remove_column

* Update test after aedcd683684d08eaf30623a4b48ce31a31426372
2012-12-22 20:40:42 -05:00
Carlos Antonio da Silva
cf05e5f6ea Stop shelling out more than necessary 2012-12-07 00:06:08 -02:00
Carlos Antonio da Silva
43c284297b Run rake tasks all at once in rake dbs test for a speed up
Before:

    Finished tests in 56.245787s, 0.2133 tests/s, 0.0000 assertions/s.
    12 tests, 0 assertions, 0 failures, 0 errors, 0 skips

After:
    Finished tests in 42.401416s, 0.2830 tests/s, 0.0000 assertions/s.
    12 tests, 0 assertions, 0 failures, 0 errors, 0 skips
2012-12-06 21:43:14 -02:00
Carlos Antonio da Silva
137f3be81b Fix failing tests related to rake notes
Related to changes introduced in 553b563749517114323b4e8742509227e0daab67
2012-12-03 09:24:13 -02:00
Antonio Cangiano
553b563749 Add db to the list of default annotation folders 2012-12-01 12:23:39 -08:00
Brent J. Nordquist
06129c0e3f Add .rake to rake notes and rake notes:custom 2012-10-12 10:52:22 -05:00
Rafael Mendonça França
9cd831a0b0 Fix syntax error in assert_match 2012-09-15 09:13:48 -03:00
Arun Agrawal
ff04bb84e1 Few more warnings removed.
I found them when I was running
warning mode on with railties

See https://github.com/rails/rails/pull/3782
2012-09-15 14:26:04 +05:30
Grace Liu
148c50b49a fixed support for DATABASE_URL for rake db tasks
- added tests to confirm establish_connection uses DATABASE_URL and
  Rails.env correctly even when no arguments are passed in.
- updated rake db tasks to support DATABASE_URL, and added tests to
  confirm correct behavior for these rake tasks.  (Removed
  establish_connection call from some tasks since in those cases
  the :environment task already made sure the function would be called)
- updated Resolver so that when it resolves the database url, it
  removes hash values with empty strings from the config spec (e.g.
  to support connection to postgresql when no username is specified).
2012-09-11 20:40:13 -07:00
Aaron Patterson
f945d157f7 run the notes tests in isolation 2012-06-19 19:08:13 -07:00
Arun Agrawal
4646b2ecac Warnings removed for "assert_match /". 2012-05-30 14:35:55 +05:30
Jason Noble
324201d7b9 Remove empty lines. 2012-04-30 09:16:29 -06:00
Jason Noble
773123178e Fixed styling issues brought up by @jeremy 2012-04-30 07:51:23 -06:00
Jason Noble & Ralph Shnelvar
e053b415e7 Add ability to specify custom annotation directories
SOURCE_ANNOTATION_DIRECTORIES='dir1,dir2' bundle exec rake notes

   Searches app, config, lib, script, test (default)
   Also searches dir1, dir2

References: #4536, #4540
2012-04-30 07:48:36 -06:00
Jason Noble & Ralph Shnelvar
b5472cf7f2 Add test coverage for rake notes
Add separate tests to verify directories covered
Add tests to verify file_types
2012-04-30 07:48:35 -06:00
Teng Siong Ong
55ceced1fb rake notes and rake notes:custom now support
css, scss and css.
2012-04-22 18:45:13 -05:00
Anton Lindqvist
c5f4b20275 Fixed missing space bug introduces in rails/rails@9299bfdcd3. 2012-03-22 12:25:28 +01:00
Carlos Antonio da Silva
73e8e70066 Use one system call whenever possible, group rake and Dir.chdir calls 2012-03-08 19:57:17 -03:00
Peter Mitchell
910c59fffe Correctly print names of non-timestamped migrations with db:migrate:status 2012-02-17 16:58:11 +01:00
Bartlomiej Kozal
dd8c6f0556 Display annotations from .coffee files in rake notes 2012-02-05 16:42:35 +01:00
Aaron Patterson
8f309e3105 convert railties to use AS::TestCase 2012-01-05 17:30:17 -08:00
Anton Lindqvist
9299bfdcd3 Align rake notes. 2011-12-26 16:58:30 +01:00
José Valim
283a087634 Clean up the cache before the request in case we are running in the reload_classes_only_on_change schema. 2011-12-15 18:48:10 +01:00
Piotr Sarnacki
866d2dbd87 Fix indentation 2011-12-09 22:00:56 +01:00
Piotr Sarnacki
35a1744a45 Allow to run migrations with given scope, with SCOPE=<scope>
Scope in migrations can be defined by adding suffix in filename,
like: 01_a_migration.blog.rb. Such migration have blog scope.

Scope is automatically added while copying migrations from engine,
so if you want to revert all of the migrations from given engine,
you can just run db:migrate with SCOPE, like:

    rake db:migrate SCOPE=blog
2011-12-09 22:00:51 +01:00
Kazimierz Kiełkowicz
c6e6ce437c Moves migrations tests from railties/test/application/rake_test.rb to railties/test/application/rake/migrations_test.rb 2011-12-07 17:34:29 +01:00
Kazimierz Kiełkowicz
c45f744bb0 Move rake notes test to railties/test/application/rake/notes_test.rb 2011-12-07 17:31:31 +01:00