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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4be5b8f2d228b4b8723ace10fe35368c09b4dbb
4
- data.tar.gz: 66d5e88c635c04cf0e1c05cbe314e094a6683f06
3
+ metadata.gz: 30d378a83bdf4b3d6836c8f59a5ca6b49144de1e
4
+ data.tar.gz: fe2164ccd7be01006fe9ded1bef2c6d81103451d
5
5
  SHA512:
6
- metadata.gz: 90fad35353ed5f86ffaf27a5a803a48cee4edeba7b91963f63c18484f65d4e43f70d8aa1927ef9d017b359b19c0a5f20cedb4b18d9bfe608e9ba6bc82dcb421d
7
- data.tar.gz: e5a1b1058ffafa7c189c4c587ddd10d9cda57fdcce59d622efdb1d6fa855e8dae8456e37430656f77986669226fba53c5dcdf7b671d50ec0e53ab8e42b25a512
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 `spec/dummy`.
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 nil; creates generic Rails app.
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 ENGINE:install:migrations`. Defaults to nil; engine specific migrations are not installed.
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
 
@@ -40,6 +40,7 @@ module Rails
40
40
  alias_method :create_test_files, :do_nothing
41
41
  alias_method :finish_template, :do_nothing
42
42
  alias_method :create_bin_files, :do_nothing
43
+ alias_method :create_images_directory, :do_nothing
43
44
  end
44
45
  end
45
46
  end
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Dummy
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -1,18 +1,26 @@
1
1
  namespace :dummy do
2
- desc 'Generates a dummy app for testing. Use options: `DUMMY_APP_PATH` and `ENGINE`'
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 'No `TEMPLATE` environment variable was set, no template to apply.'
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 'No `ENGINE` environment variable was set, no migrations to install.'
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 db:test:prepare" % rakefile
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
 
@@ -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", "~> 2.0"
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
@@ -19,6 +19,6 @@ describe Rails::Dummy::Generator do
19
19
  params << dummy_path
20
20
  Rails::Dummy::Generator.start(params)
21
21
 
22
- Dir[File.join(@current_path, dummy_path, '*')].should_not be_empty
22
+ expect(Dir[File.join(@current_path, dummy_path, '*')]).to_not be_empty
23
23
  end
24
24
  end
@@ -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,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'dummy:app' do
3
+ describe 'dummy:app', type: :task do
4
4
  its(:prerequisites) { should include('setup') }
5
5
  its(:prerequisites) { should include('template') }
6
6
  its(:prerequisites) { should include('install_migrations') }
@@ -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
- # An equivalent of mocking `sh` method
9
- Rake::AltSystem.should_not_receive(:system)
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
- # An equivalent of mocking `sh` method
26
- Rake::AltSystem.should_receive(:system).with(command).and_return(true)
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
- # An equivalent of mocking `sh` method
22
- Rake::AltSystem.should_receive(:system).with(command).and_return(true)
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
- # An equivalent of mocking `sh` method
9
- Rake::AltSystem.should_not_receive(:system)
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
- # An equivalent of mocking `sh` method
26
- Rake::AltSystem.should_receive(:system).with(command).and_return(true)
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.should_receive(:rm_rf).with(full_dummy_path)
9
- Rails::Dummy::Generator.should_receive(:start).with(
10
- %W(. -q -f --skip-bundle -T -G --dummy-path=#{full_dummy_path})
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
- # An equivalent of mocking `sh` method
25
- Rake::AltSystem.should_receive(:system).with(command).and_return(true)
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
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: 2014-07-09 00:00:00.000000000 Z
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: '2.0'
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: '2.0'
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.2.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