spec/integration/ruby_spec.rb in vx-builder-0.2.1 vs spec/integration/ruby_spec.rb in vx-builder-0.2.2
- old
+ new
@@ -7,34 +7,35 @@
let(:matrix) { Vx::Builder::Matrix.new build_configuration }
let(:task) { create :task }
let(:script) { Vx::Builder::Script.new(task, source) }
subject { matrix }
+ def write_script_to_filter(prefix)
+=begin
+ File.open(fixture_path("integration/ruby/#{prefix}before_script.sh"), 'w') do |io|
+ io << script.to_before_script
+ end
+ File.open(fixture_path("integration/ruby/#{prefix}after_script.sh"), 'w') do |io|
+ io << script.to_after_script
+ end
+ File.open(fixture_path("integration/ruby/#{prefix}script.sh"), 'w') do |io|
+ io << script.to_script
+ end
+=end
+ end
+
context "language" do
let(:config) { fixture("integration/ruby/language/config.yml") }
its(:build_configurations) { should have(1).item }
context "first configuration" do
let(:source) { matrix.build_configurations.first }
subject { script }
+ before { write_script_to_filter "language/" }
- before do
-=begin
- File.open(fixture_path("integration/ruby/language/before_script.sh"), 'w') do |io|
- io << script.to_before_script
- end
- File.open(fixture_path("integration/ruby/language/after_script.sh"), 'w') do |io|
- io << script.to_after_script
- end
- File.open(fixture_path("integration/ruby/language/script.sh"), 'w') do |io|
- io << script.to_script
- end
-=end
- end
-
it { should_not be_deploy }
its(:to_before_script) { should eq fixture("integration/ruby/language/before_script.sh") }
its(:to_script) { should eq fixture("integration/ruby/language/script.sh") }
its(:to_after_script) { should eq fixture("integration/ruby/language/after_script.sh") }
end
@@ -46,23 +47,11 @@
context "configuration" do
let(:task) { create :task, deploy: true }
let(:source) { matrix.deploy_configuration("master") }
subject { script }
- before do
-=begin
- File.open(fixture_path("integration/ruby/deploy/d.before_script.sh"), 'w') do |io|
- io << script.to_before_script
- end
- File.open(fixture_path("integration/ruby/deploy/d.after_script.sh"), 'w') do |io|
- io << script.to_after_script
- end
- File.open(fixture_path("integration/ruby/deploy/d.script.sh"), 'w') do |io|
- io << script.to_script
- end
-=end
- end
+ before { write_script_to_filter "deploy/d." }
it "should have source" do
expect(source).to be
end
@@ -80,23 +69,11 @@
context "0th configuration" do
let(:source) { matrix.build_configurations[0] }
subject { script }
- before do
-=begin
- File.open(fixture_path("integration/ruby/matrix/0.before_script.sh"), 'w') do |io|
- io << script.to_before_script
- end
- File.open(fixture_path("integration/ruby/matrix/0.after_script.sh"), 'w') do |io|
- io << script.to_after_script
- end
- File.open(fixture_path("integration/ruby/matrix/0.script.sh"), 'w') do |io|
- io << script.to_script
- end
-=end
- end
+ before { write_script_to_filter "matrix/0." }
it { should_not be_deploy }
its(:to_before_script) { should eq fixture("integration/ruby/matrix/0.before_script.sh") }
its(:to_script) { should eq fixture("integration/ruby/matrix/0.script.sh") }
its(:to_after_script) { should eq fixture("integration/ruby/matrix/0.after_script.sh") }
@@ -104,23 +81,11 @@
context "1th configuration" do
let(:source) { matrix.build_configurations[1] }
subject { script }
- before do
-=begin
- File.open(fixture_path("integration/ruby/matrix/1.before_script.sh"), 'w') do |io|
- io << script.to_before_script
- end
- File.open(fixture_path("integration/ruby/matrix/1.after_script.sh"), 'w') do |io|
- io << script.to_after_script
- end
- File.open(fixture_path("integration/ruby/matrix/1.script.sh"), 'w') do |io|
- io << script.to_script
- end
-=end
- end
+ before { write_script_to_filter "matrix/1." }
it { should_not be_deploy }
its(:to_before_script) { should eq fixture("integration/ruby/matrix/1.before_script.sh") }
its(:to_script) { should eq fixture("integration/ruby/matrix/1.script.sh") }
its(:to_after_script) { should eq fixture("integration/ruby/matrix/1.after_script.sh") }
@@ -129,22 +94,10 @@
context "deploy configuration" do
let(:task) { create :task, deploy: true }
let(:source) { matrix.deploy_configuration("master") }
subject { script }
- before do
-=begin
- File.open(fixture_path("integration/ruby/matrix/d.before_script.sh"), 'w') do |io|
- io << script.to_before_script
- end
- File.open(fixture_path("integration/ruby/matrix/d.after_script.sh"), 'w') do |io|
- io << script.to_after_script
- end
- File.open(fixture_path("integration/ruby/matrix/d.script.sh"), 'w') do |io|
- io << script.to_script
- end
-=end
- end
+ before { write_script_to_filter "matrix/d." }
it "should have source" do
expect(source).to be
end