rails-dummy 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/lib/rails/dummy/generator.rb +1 -0
- data/lib/rails/dummy/version.rb +1 -1
- data/lib/tasks/dummy.rake +15 -4
- data/rails-dummy.gemspec +2 -1
- data/spec/integration/generator_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/tasks/dummy_app_spec.rb +1 -1
- data/spec/tasks/dummy_create_spec.rb +7 -5
- data/spec/tasks/dummy_install_migrations_spec.rb +5 -11
- data/spec/tasks/dummy_migrate_spec.rb +25 -6
- data/spec/tasks/dummy_setup_spec.rb +8 -4
- data/spec/tasks/dummy_template_spec.rb +5 -5
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30d378a83bdf4b3d6836c8f59a5ca6b49144de1e
|
4
|
+
data.tar.gz: fe2164ccd7be01006fe9ded1bef2c6d81103451d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ead6b440b32d76287063ae9bc485f89a1638ff8009e756106358b62e6ec6e6afd170b8a37ddc8a80788eb911deb717afe1d718f2dadf2f699f7ab259bdecad89
|
7
|
+
data.tar.gz: bad4e8e3691f0c34db3ea667a5b6c3bf780e0b5c1e35dfca3cd46cd3b3e1f1f15fd6e423ce2d902153e569d2ad881d9e941d4237aa814baecf699abd12ed9c90
|
data/README.md
CHANGED
@@ -30,11 +30,17 @@ Now you should be able to run:
|
|
30
30
|
|
31
31
|
## Customization by environment variables:
|
32
32
|
|
33
|
-
`DUMMY_APP_PATH` - Specify path where dummy app will be located. Defaults to
|
33
|
+
`DUMMY_APP_PATH` - Specify path where dummy app will be located. Defaults to
|
34
|
+
`spec/dummy`.
|
34
35
|
|
35
|
-
`TEMPLATE` - Specify a Rails template by path location variable. Defaults to
|
36
|
+
`TEMPLATE` - Specify a Rails template by path location variable. Defaults to
|
37
|
+
nil; creates generic Rails app.
|
36
38
|
|
37
|
-
`ENGINE` - Specify engine name migrations to be installed via `rake
|
39
|
+
`ENGINE` - Specify engine name migrations to be installed via `rake
|
40
|
+
ENGINE:install:migrations`. Defaults to nil; engine specific migrations are not
|
41
|
+
installed.
|
42
|
+
|
43
|
+
`ENGINE_DB` - Specify engine database. Defaults to `sqlite3`.
|
38
44
|
|
39
45
|
`DISABLE_CREATE` - Don't run `db:create`.
|
40
46
|
|
data/lib/rails/dummy/version.rb
CHANGED
data/lib/tasks/dummy.rake
CHANGED
@@ -1,18 +1,26 @@
|
|
1
1
|
namespace :dummy do
|
2
|
-
desc
|
2
|
+
desc(
|
3
|
+
'Generates a dummy app for testing.'\
|
4
|
+
'Use options: `DUMMY_APP_PATH`, `ENGINE` and `ENGINE_DB`'
|
5
|
+
)
|
3
6
|
task :app => [:setup, :template, :install_migrations, :create, :migrate]
|
4
7
|
|
5
8
|
task :setup do
|
6
9
|
dummy = File.expand_path(dummy_path)
|
10
|
+
database = ENV['ENGINE_DB'] || 'sqlite3'
|
11
|
+
|
7
12
|
FileUtils.rm_rf(dummy)
|
8
13
|
params = %W{. -q -f --skip-bundle -T -G}
|
9
14
|
params << '--dummy-path=%s' % dummy
|
15
|
+
params << '--database=%s' % database
|
10
16
|
Rails::Dummy::Generator.start(params)
|
11
17
|
end
|
12
18
|
|
13
19
|
task :template do
|
14
20
|
unless ENV['TEMPLATE']
|
15
|
-
Kernel.puts
|
21
|
+
Kernel.puts(
|
22
|
+
'No `TEMPLATE` environment variable was set, no template to apply.'
|
23
|
+
)
|
16
24
|
else
|
17
25
|
# File.expand_path is executed directory of generated Rails app
|
18
26
|
rakefile = File.expand_path('Rakefile', dummy_path)
|
@@ -27,7 +35,9 @@ namespace :dummy do
|
|
27
35
|
task :install_migrations do
|
28
36
|
engine = ENV['ENGINE']
|
29
37
|
unless engine
|
30
|
-
Kernel.puts
|
38
|
+
Kernel.puts(
|
39
|
+
'No `ENGINE` environment variable was set, no migrations to install.'
|
40
|
+
)
|
31
41
|
else
|
32
42
|
# File.expand_path is executed directory of generated Rails app
|
33
43
|
rakefile = File.expand_path('Rakefile', dummy_path)
|
@@ -47,7 +57,8 @@ namespace :dummy do
|
|
47
57
|
task :migrate do
|
48
58
|
# File.expand_path is executed directory of generated Rails app
|
49
59
|
rakefile = File.expand_path('Rakefile', dummy_path)
|
50
|
-
command = "rake -f '%s' db:migrate
|
60
|
+
command = "rake -f '%s' db:migrate" % rakefile
|
61
|
+
command << " db:test:prepare" if ::Rails::VERSION::STRING.to_f < 4.1
|
51
62
|
sh(command) unless ENV["DISABLE_MIGRATE"]
|
52
63
|
end
|
53
64
|
|
data/rails-dummy.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rspec", "~>
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.7"
|
26
|
+
spec.add_development_dependency "rspec-its"
|
26
27
|
spec.add_development_dependency "rspec-rake"
|
27
28
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rails/dummy/generator'
|
2
|
+
require 'rspec/its'
|
2
3
|
require 'rspec/rake'
|
3
4
|
|
4
5
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
@@ -8,7 +9,6 @@ require 'rspec/rake'
|
|
8
9
|
#
|
9
10
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
10
11
|
RSpec.configure do |config|
|
11
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
12
|
config.run_all_when_everything_filtered = true
|
13
13
|
config.filter_run :focus
|
14
14
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'dummy:create' do
|
3
|
+
describe 'dummy:create', type: :task do
|
4
4
|
|
5
5
|
context 'when DISABLE_CREATE variable is set' do
|
6
6
|
before do
|
7
7
|
ENV['DISABLE_CREATE'] = '1'
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
expect_any_instance_of(::Kernel).not_to receive(:system)
|
10
10
|
end
|
11
11
|
|
12
12
|
after do
|
@@ -22,8 +22,10 @@ describe 'dummy:create' do
|
|
22
22
|
before do
|
23
23
|
rakefile = File.expand_path('../../dummy/Rakefile', __FILE__)
|
24
24
|
command = "rake -f '%s' db:create" % [rakefile]
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
expect_any_instance_of(::Kernel).to(
|
27
|
+
receive(:system).with(command, {}).and_return(true)
|
28
|
+
)
|
27
29
|
end
|
28
30
|
|
29
31
|
it 'calls rake with db:create task' do
|
@@ -1,14 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'dummy:install_migrations' do
|
4
|
-
|
5
|
-
context 'when ENGINE variable was not set' do
|
6
|
-
before { Kernel.should_receive(:puts) }
|
7
|
-
|
8
|
-
it 'calls puts with a notice message' do
|
9
|
-
task.invoke
|
10
|
-
end
|
11
|
-
end
|
3
|
+
describe 'dummy:install_migrations', type: :task do
|
12
4
|
|
13
5
|
context 'when ENGINE variable is set' do
|
14
6
|
let(:engine_name) { 'TEST_ENGINE' }
|
@@ -18,8 +10,10 @@ describe 'dummy:install_migrations' do
|
|
18
10
|
rakefile = File.expand_path('../../dummy/Rakefile', __FILE__)
|
19
11
|
command = "rake -f '%s' %s:install:migrations" % [
|
20
12
|
rakefile, engine_name.downcase ]
|
21
|
-
|
22
|
-
|
13
|
+
|
14
|
+
expect_any_instance_of(::Kernel).to(
|
15
|
+
receive(:system).with(command, {}).and_return(true)
|
16
|
+
)
|
23
17
|
end
|
24
18
|
|
25
19
|
after do
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'dummy:migrate' do
|
3
|
+
describe 'dummy:migrate', type: :task do
|
4
4
|
|
5
5
|
context 'when DISABLE_MIGRATE variable is set' do
|
6
6
|
before do
|
7
7
|
ENV['DISABLE_MIGRATE'] = '1'
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
expect_any_instance_of(::Kernel).not_to receive(:system)
|
10
10
|
end
|
11
11
|
|
12
12
|
after do
|
@@ -18,12 +18,15 @@ describe 'dummy:migrate' do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
context 'when DISABLE_MIGRATE variable is not set' do
|
21
|
+
context 'when DISABLE_MIGRATE variable is not set (pre RAILS 4.1)' do
|
22
22
|
before do
|
23
|
+
stub_const("::Rails::VERSION::STRING", 3.2)
|
23
24
|
rakefile = File.expand_path('../../dummy/Rakefile', __FILE__)
|
24
25
|
command = "rake -f '%s' db:migrate db:test:prepare" % rakefile
|
25
|
-
|
26
|
-
|
26
|
+
|
27
|
+
expect_any_instance_of(::Kernel).to(
|
28
|
+
receive(:system).with(command, {}).and_return(true)
|
29
|
+
)
|
27
30
|
end
|
28
31
|
|
29
32
|
it 'calls rake with db:migrate db:test:prepare task' do
|
@@ -31,4 +34,20 @@ describe 'dummy:migrate' do
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
37
|
+
context 'when DISABLE_MIGRATE variable is not set (post RAILS 4.1)' do
|
38
|
+
before do
|
39
|
+
stub_const("::Rails::VERSION::STRING", 4.1)
|
40
|
+
rakefile = File.expand_path('../../dummy/Rakefile', __FILE__)
|
41
|
+
command = "rake -f '%s' db:migrate" % rakefile
|
42
|
+
|
43
|
+
expect_any_instance_of(::Kernel).to(
|
44
|
+
receive(:system).with(command, {}).and_return(true)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'calls rake with db:migrate task' do
|
49
|
+
task.invoke
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
34
53
|
end
|
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'dummy:setup' do
|
3
|
+
describe 'dummy:setup', type: :task do
|
4
4
|
let(:dummy_path) { 'spec/dummy' }
|
5
5
|
|
6
6
|
before do
|
7
7
|
full_dummy_path = File.expand_path("../../../#{dummy_path}", __FILE__)
|
8
|
-
FileUtils.
|
9
|
-
Rails::Dummy::Generator.
|
10
|
-
%W(
|
8
|
+
expect(FileUtils).to receive(:rm_rf).with(full_dummy_path)
|
9
|
+
expect(Rails::Dummy::Generator).to receive(:start).with(
|
10
|
+
%W(
|
11
|
+
. -q -f --skip-bundle -T -G
|
12
|
+
--dummy-path=#{full_dummy_path}
|
13
|
+
--database=sqlite3
|
14
|
+
)
|
11
15
|
)
|
12
16
|
end
|
13
17
|
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'dummy:template' do
|
3
|
+
describe 'dummy:template', type: :task do
|
4
4
|
|
5
5
|
context 'when TEMPLATE variable was not set' do
|
6
|
-
before { Kernel.should_receive(:puts) }
|
7
|
-
|
8
6
|
it 'calls puts with a notice message' do
|
9
7
|
task.invoke
|
10
8
|
end
|
@@ -21,8 +19,10 @@ describe 'dummy:template' do
|
|
21
19
|
|
22
20
|
command = "rake -f '%s' rails:template LOCATION='%s'" % [
|
23
21
|
rakefile, template_path ]
|
24
|
-
|
25
|
-
|
22
|
+
|
23
|
+
expect_any_instance_of(::Kernel).to(
|
24
|
+
receive(:system).with(command, {}).and_return(true)
|
25
|
+
)
|
26
26
|
end
|
27
27
|
|
28
28
|
after do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-dummy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas SUȘCOV
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-its
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rspec-rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
141
|
version: '0'
|
128
142
|
requirements: []
|
129
143
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.6.8
|
131
145
|
signing_key:
|
132
146
|
specification_version: 4
|
133
147
|
summary: Use it to generate a dummy app for RSpec
|