schema_dev 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -0
- data/Rakefile +4 -0
- data/lib/schema_dev/ruby_selector.rb +3 -0
- data/lib/schema_dev/version.rb +1 -1
- data/spec/runner_spec.rb +58 -23
- data/templates/gemfiles/Gemfile.base +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3e90e72ec9c8d5f4ad5f33892d5a17f496700bf
|
4
|
+
data.tar.gz: caf430be490dde34eb6e58082c2fe9de12e7d96b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a08016cbd5d97ec57805fcc60ef43f890378434c31cf22ce180af876f04c55e911ff9b5d96bf592abc053f32dd35f1982e8c06a9ce6296ce46b20206a63d7cd
|
7
|
+
data.tar.gz: 0327f9e26f5afc36ba900e6cbcfa09312737dc3fcde6377da84afec6de577ac2fc5f80f0db08af0d86c932edb970010338d331d3448bce64c004e58cc396fd66
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/schema_dev.svg)](http://badge.fury.io/rb/schema_dev)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_dev.svg)](http://travis-ci.org/SchemaPlus/schema_dev)
|
5
|
+
[![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_dev.svg)](https://coveralls.io/r/SchemaPlus/schema_dev)
|
5
6
|
|
6
7
|
Development tools for the SchemaPlus family of gems.
|
7
8
|
|
data/Rakefile
CHANGED
data/lib/schema_dev/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -20,50 +20,85 @@ describe SchemaDev::Runner do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
Selectors = {
|
24
|
+
'chruby-exec' => "SHELL=`which bash` chruby-exec ruby-#{RUBY_VERSION} --",
|
25
|
+
'rvm' => "rvm #{RUBY_VERSION} do",
|
26
|
+
'rbenv' => "RBENV_VERSION=#{RUBY_VERSION}"
|
27
|
+
}
|
26
28
|
|
27
|
-
|
29
|
+
Selectors.each do |selector, selection_command|
|
30
|
+
|
31
|
+
describe "matrix (#{selector})" do
|
32
|
+
before(:each) do
|
33
|
+
# mocking RubySelector to find selector
|
34
|
+
SchemaDev::RubySelector._reset
|
35
|
+
Selectors.keys.each do |k|
|
36
|
+
allow(SchemaDev::RubySelector).to receive(:system).with("which -s #{k}").and_return k == selector
|
37
|
+
end
|
38
|
+
case selector
|
39
|
+
when 'chruby-exec'
|
40
|
+
expect_any_instance_of(Pathname).to receive(:entries).and_return [Pathname.new("ruby-#{RUBY_VERSION}")]
|
41
|
+
when 'rbenv'
|
42
|
+
expect_any_instance_of(SchemaDev::RubySelector::Rbenv).to receive(:`).with("rbenv versions --bare").and_return RUBY_VERSION
|
43
|
+
end
|
44
|
+
|
45
|
+
# mocking execution
|
46
|
+
original_popen2e = Open3.method(:popen2e)
|
47
|
+
allow(Open3).to receive(:popen2e) { |cmd, &block|
|
48
|
+
cmd = case cmd
|
49
|
+
when /false$/ then "false"
|
50
|
+
when /true$/ then "true"
|
51
|
+
else cmd.sub(/.*echo/, "echo")
|
52
|
+
end
|
53
|
+
original_popen2e.call(cmd, &block)
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
let(:config) { get_config(ruby: RUBY_VERSION, rails: "4.0", db: %W[sqlite3 postgresql]) }
|
58
|
+
let(:runner) { SchemaDev::Runner.new(config) }
|
59
|
+
|
60
|
+
|
61
|
+
let(:expected_output) { <<ENDOUTPUT.strip }
|
28
62
|
* Updated .travis.yml
|
29
63
|
|
30
64
|
|
31
65
|
*** ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3 [1 of 2]
|
32
66
|
|
33
|
-
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.sqlite3
|
67
|
+
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.sqlite3 #{selection_command} %{cmd}
|
34
68
|
%{output}
|
35
69
|
|
36
70
|
*** ruby #{RUBY_VERSION} - rails 4.0 - db postgresql [2 of 2]
|
37
71
|
|
38
|
-
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.postgresql
|
72
|
+
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.postgresql #{selection_command} %{cmd}
|
39
73
|
%{output}
|
40
74
|
ENDOUTPUT
|
41
75
|
|
42
|
-
|
43
|
-
|
44
|
-
|
76
|
+
it "runs successfully" do
|
77
|
+
in_tmpdir do
|
78
|
+
expect{ runner.run("true") }.to output(expected_output % {cmd: 'true', output: nil}).to_stdout
|
79
|
+
end
|
45
80
|
end
|
46
|
-
end
|
47
81
|
|
48
|
-
|
49
|
-
|
50
|
-
|
82
|
+
it "reports error exits" do
|
83
|
+
in_tmpdir do
|
84
|
+
expect{ runner.run("false") }.to output(expected_output % {cmd: 'false', output: nil} + <<-ENDERR).to_stdout
|
51
85
|
|
52
86
|
*** 2 failures:
|
53
|
-
|
54
|
-
|
55
|
-
ENDERR
|
87
|
+
\truby #{RUBY_VERSION} - rails 4.0 - db sqlite3
|
88
|
+
\truby #{RUBY_VERSION} - rails 4.0 - db postgresql
|
89
|
+
ENDERR
|
90
|
+
end
|
56
91
|
end
|
57
|
-
end
|
58
92
|
|
59
|
-
|
60
|
-
|
61
|
-
|
93
|
+
it "reports error messages" do
|
94
|
+
in_tmpdir do
|
95
|
+
expect{ runner.run("echo", "LoadError") }.to output(expected_output % {cmd: 'echo LoadError', output: "LoadError\n"} + <<-ENDERR).to_stdout
|
62
96
|
|
63
97
|
*** 2 failures:
|
64
|
-
|
65
|
-
|
66
|
-
ENDERR
|
98
|
+
\truby #{RUBY_VERSION} - rails 4.0 - db sqlite3
|
99
|
+
\truby #{RUBY_VERSION} - rails 4.0 - db postgresql
|
100
|
+
ENDERR
|
101
|
+
end
|
67
102
|
end
|
68
103
|
end
|
69
104
|
end
|