named_seeds 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: faba2937d0e01b1c4fe753d384443646f6a646fa
4
+ data.tar.gz: 834e8f40a54ddfd993cd06fa185e19bc0aad1dd4
5
+ SHA512:
6
+ metadata.gz: 05516f577aff9af4ea8fa809410bdd0274096632b9e7a4270acffec2083163fb6789b5abf897b39b3f3968102d96d460a139344c4d4b4331801e547f5cd8b4e8
7
+ data.tar.gz: 4053bcc81a480683425c944c71c391a7a005e59f62b717949e28b631df468e84333435fcc748bdccf7ad22a6cfbe58c5cd5862303ebf81e9ec9096f00975dff2
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # NamedSeeds
2
2
 
3
- **Make you tests fast by augmenting them with transactional fixtures powered by your favorite factory library!**
3
+ **Make your tests fast by augmenting them with transactional fixtures powered by your favorite factory library!**
4
4
 
5
- We all know that ActiveRecord::Fixtures suck because they are authored in YAML files. But Rails did get something right, transactional tests and easy helper methods to access fixtures by name. NamedSeeds aims to be a drop in replacement for Rails fixtures or an enhancement to RSpec and Cucumber while using any object generator of your choice!
5
+ We all know that ActiveRecord::Fixtures are hard to maintain and are disconnected from the models that save your data. But Rails did get something right with transactional tests and easy helper methods to access fixtures by name. NamedSeeds aims to be a drop-in replacement for Rails fixtures or an enhancement to RSpec and Cucumber while using any object generator of your choice!
6
6
 
7
- The idea is to leverage your tests' existing factories to generate fixtures that will be populated before testing starts and to use a database transaction strategy around each test. In this way you have a populated story that can be accessed via convienient helper methods like `users(:admin)` which inturn yields much faster test runs. Database fixtures, even those seeded by factories, are not a pancea and we highly suggested that you continue to use factories in your tests when it makes sense to do so. For those that think this is mad or have FUD to share, please see my blog articles..
7
+ The idea is to leverage your tests' existing factories to generate fixtures that will be populated before testing starts and to use a database transaction strategy around each test. In this way you have a populated story that can be accessed via convienient helper methods like `users(:admin)` which in turn yields much faster test runs. Database fixtures, even those seeded by factories, are not a panacea and we highly suggested that you continue to use factories in your tests when it makes sense to do so. For those that think this is mad or have FUD to share, please see my blog articles:
8
8
 
9
9
  * Inprogress...
10
10
  * Inprogress...
@@ -26,7 +26,7 @@ NamedSeeds requires that you create a `db/test/seeds.rb` file. The contents of t
26
26
 
27
27
  ```ruby
28
28
  require 'factory_girl'
29
- FactoryGirl.find_definitions rescue true
29
+ FactoryGirl.reload
30
30
 
31
31
  @bob = FactoryGirl.create :user, :id => NamedSeeds.identify(:bob), :email => 'bob@test.com'
32
32
  ```
@@ -38,16 +38,16 @@ Use the `NamedSeeds.identify` method to give a name to the identity used for thi
38
38
 
39
39
  **Using these tasks manually should not be needed as both are hooked into the proper `test:prepare` and `db:setup` process for you.**
40
40
 
41
- NamedSeeds includes two rake tasks. The `db:test:seeds` is the one that does all the work and is automatically called after Rails' `test:prepare` for you. So running your rake test tasks will create your test database and seed it for you automatically before your tests run.
41
+ NamedSeeds includes two rake tasks. The `db:test:seeds` is the one that does all the work and is automatically called after Rails' `test:prepare` for you. So running your rake test tasks will create your test database and seed it for you automatically before your tests run. Remember, ActiveRecords `db:test:prepare` is not a proper hook, read [my comment](https://github.com/rspec/rspec-rails/issues/663#issuecomment-11831559) on this rspec issue for more details.
42
42
 
43
- The other task is `db:development:seed`. This task invokes the normal Rails' `db:seed` task, then loads the db/test/seeds.rb file while still in development mode. We automatically call this task after `db:setup` for you. This task provides a way for a developer to populate their development database with the same fixture story used for testing. This makes it easy for developers to learn your application as the test story is a 1 to 1 mapping of data in local development.
43
+ The other task is `db:development:seed`. This task invokes the normal Rails `db:seed` task, then loads the db/test/seeds.rb file while still in development mode. We automatically call this task after `db:setup` for you. This task provides a way for a developer to populate their development database with the same fixture story used for testing. This makes it easy for developers to learn your application as the test story is a 1 to 1 mapping of data in local development.
44
44
 
45
45
  ```shell
46
46
  $ rake db:test:seed # Run the seed data from db/test/seeds.rb and
47
- # optional your Rails db/seeds.rb if you have
47
+ # optionally your Rails db/seeds.rb if you have
48
48
  # configured `app_load_seed` below.
49
49
 
50
- $ rake db:development:seed # Runs the normal Rails `db:seed` task then the
50
+ $ rake db:development:seed # Runs the normal Rails `db:seed` task then
51
51
  # loads the db/test/seeds.rb file.
52
52
  ```
53
53
 
@@ -95,7 +95,8 @@ Review how helper methods may map to custom table names. Like Rails did with #fi
95
95
 
96
96
  ## Configurations
97
97
 
98
- NamedSeeds is a `Rails::Railtie` that exposes a few `config` options. So open up the `config/environments/development.rb` **(yes in development.rb)** and use the `config.named_seeds` options below.
98
+ NamedSeeds is a `Rails::Railtie` that exposes a few `config` options. So open up the `config/environments/development.rb` **(yes in development.rb)** and use the `config.named_seeds` options below. NOTE: I have found that sometimes I need to add some configurations to `config/environments/test.rb` too. Mainly when using [spring](https://github.com/jonleighton/spring). So adding `config.named_seeds.app_load_seed = true` is what I needed.
99
+
99
100
 
100
101
  * *app_load_seed* - Load your Rails application's db/seeds.rb file into the test database. This is done before db/test/seeds.rb is loaded. Default is false.
101
102
  * *engines_with_load_seed* - Some Rails engines provide a load seed hook. If you want NamedSeed to call the engine's seed method into your tests database, push the engine constant to this array. Any object responding to `load_seed` sould work here too. Default is an empty array.
@@ -135,7 +136,7 @@ Show examples with these 3 factory libraries.
135
136
  * https://github.com/paulelliott/fabrication
136
137
  * https://github.com/notahat/machinist
137
138
 
138
- Setup a dummy_application in test.
139
+ Set up a dummy_application in test.
139
140
 
140
141
  How are we different from:
141
142
 
@@ -1,3 +1,3 @@
1
1
  module NamedSeeds
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -14,9 +14,9 @@ Gem::Specification.new do |gem|
14
14
  gem.files = `git ls-files`.split("\n")
15
15
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
  gem.require_paths = ["lib"]
17
- gem.add_runtime_dependency 'rails', '>= 3.1'
17
+ gem.add_runtime_dependency 'rails', '>= 3.1', '< 4.2'
18
18
  gem.add_runtime_dependency 'database_cleaner'
19
- gem.add_development_dependency 'sqlite3', '~> 1.3'
20
- gem.add_development_dependency 'rake', '~> 0.9.2'
21
- gem.add_development_dependency 'minitest', '~> 2.8.1'
19
+ gem.add_development_dependency 'sqlite3'
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'minitest'
22
22
  end
@@ -1,6 +1,6 @@
1
1
  ActiveRecord::Base.class_eval do
2
- silence do
3
-
2
+ silence(:stdout) do
3
+
4
4
  connection.create_table :users, :force => true do |t|
5
5
  t.string :name, :email
6
6
  end
metadata CHANGED
@@ -1,96 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: named_seeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
5
- prerelease:
4
+ version: 1.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ken Collins
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
11
+ date: 2014-10-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.2'
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.2'
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: database_cleaner
32
35
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
36
  requirements:
35
- - - ! '>='
37
+ - - ">="
36
38
  - !ruby/object:Gem::Version
37
39
  version: '0'
38
40
  type: :runtime
39
41
  prerelease: false
40
42
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
43
  requirements:
43
- - - ! '>='
44
+ - - ">="
44
45
  - !ruby/object:Gem::Version
45
46
  version: '0'
46
47
  - !ruby/object:Gem::Dependency
47
48
  name: sqlite3
48
49
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
50
  requirements:
51
- - - ~>
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '1.3'
53
+ version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
57
  requirements:
59
- - - ~>
58
+ - - ">="
60
59
  - !ruby/object:Gem::Version
61
- version: '1.3'
60
+ version: '0'
62
61
  - !ruby/object:Gem::Dependency
63
62
  name: rake
64
63
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
64
  requirements:
67
- - - ~>
65
+ - - ">="
68
66
  - !ruby/object:Gem::Version
69
- version: 0.9.2
67
+ version: '0'
70
68
  type: :development
71
69
  prerelease: false
72
70
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
71
  requirements:
75
- - - ~>
72
+ - - ">="
76
73
  - !ruby/object:Gem::Version
77
- version: 0.9.2
74
+ version: '0'
78
75
  - !ruby/object:Gem::Dependency
79
76
  name: minitest
80
77
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
78
  requirements:
83
- - - ~>
79
+ - - ">="
84
80
  - !ruby/object:Gem::Version
85
- version: 2.8.1
81
+ version: '0'
86
82
  type: :development
87
83
  prerelease: false
88
84
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
85
  requirements:
91
- - - ~>
86
+ - - ">="
92
87
  - !ruby/object:Gem::Version
93
- version: 2.8.1
88
+ version: '0'
94
89
  description: Make you tests fast by augmenting them with transactional fixtures powered
95
90
  by your favorite factory library!
96
91
  email:
@@ -99,7 +94,7 @@ executables: []
99
94
  extensions: []
100
95
  extra_rdoc_files: []
101
96
  files:
102
- - .gitignore
97
+ - ".gitignore"
103
98
  - CHANGELOG.md
104
99
  - Gemfile
105
100
  - LICENSE
@@ -119,31 +114,29 @@ files:
119
114
  - test/test_helper.rb
120
115
  homepage: http://github.com/metaskills/named_seeds
121
116
  licenses: []
117
+ metadata: {}
122
118
  post_install_message:
123
119
  rdoc_options: []
124
120
  require_paths:
125
121
  - lib
126
122
  required_ruby_version: !ruby/object:Gem::Requirement
127
- none: false
128
123
  requirements:
129
- - - ! '>='
124
+ - - ">="
130
125
  - !ruby/object:Gem::Version
131
126
  version: '0'
132
127
  required_rubygems_version: !ruby/object:Gem::Requirement
133
- none: false
134
128
  requirements:
135
- - - ! '>='
129
+ - - ">="
136
130
  - !ruby/object:Gem::Version
137
131
  version: '0'
138
132
  requirements: []
139
133
  rubyforge_project:
140
- rubygems_version: 1.8.24
134
+ rubygems_version: 2.3.0
141
135
  signing_key:
142
- specification_version: 3
143
- summary: ! 'Replace ActiveRecord::Fixtures With #{your_factory_lib}.'
136
+ specification_version: 4
137
+ summary: 'Replace ActiveRecord::Fixtures With #{your_factory_lib}.'
144
138
  test_files:
145
139
  - test/cases/base_test.rb
146
140
  - test/support/models.rb
147
141
  - test/support/schema.rb
148
142
  - test/test_helper.rb
149
- has_rdoc: