Refactor spec runners to be separate tests
parent
097c00d5c1
commit
90f319e9f5
|
|
@ -0,0 +1,17 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
require 'squib'
|
||||||
|
require 'pp'
|
||||||
|
|
||||||
|
describe "Squib samples" do
|
||||||
|
|
||||||
|
Dir["#{samples_dir}/**/*.rb"].each do |sample|
|
||||||
|
it "executes #{sample} with no errors", slow: true do
|
||||||
|
allow(Squib.logger).to receive(:warn) {}
|
||||||
|
allow(ProgressBar).to receive(:create).and_return(Squib::DoNothing.new)
|
||||||
|
Dir.chdir(File.dirname(sample)) do
|
||||||
|
load sample
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -3,25 +3,13 @@ require 'squib'
|
||||||
require 'pp'
|
require 'pp'
|
||||||
|
|
||||||
describe "Squib samples" do
|
describe "Squib samples" do
|
||||||
@SAMPLES_DIR = "#{File.expand_path(File.dirname(__FILE__))}/../../samples/"
|
|
||||||
let(:samples_dir) { "#{File.expand_path(File.dirname(__FILE__))}/../../samples/" }
|
|
||||||
|
|
||||||
around(:each) do |example|
|
around(:each) do |example|
|
||||||
Dir.chdir(samples_dir) do
|
Dir.chdir(samples_dir) do
|
||||||
example.run
|
example.run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir["#{@SAMPLES_DIR}/**/*.rb"].each do |sample|
|
|
||||||
it "should execute #{sample} with no errors", slow: true do
|
|
||||||
allow(Squib.logger).to receive(:warn) {}
|
|
||||||
allow(ProgressBar).to receive(:create).and_return(Squib::DoNothing.new)
|
|
||||||
Dir.chdir(File.dirname(sample)) do
|
|
||||||
load sample
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# This test could use some explanation
|
# This test could use some explanation
|
||||||
# Much of the development of Squib has been sample-driven. Every time I want
|
# Much of the development of Squib has been sample-driven. Every time I want
|
||||||
# new syntax or feature, I write a sample, get it working, and then write
|
# new syntax or feature, I write a sample, get it working, and then write
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,14 @@ RSpec.configure do |config|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tmp_dir
|
||||||
|
"#{File.expand_path(File.dirname(__FILE__))}/../tmp"
|
||||||
|
end
|
||||||
|
|
||||||
|
def samples_dir
|
||||||
|
File.expand_path("#{File.dirname(__FILE__)}/../samples")
|
||||||
|
end
|
||||||
|
|
||||||
def layout_file(str)
|
def layout_file(str)
|
||||||
"#{File.expand_path(File.dirname(__FILE__))}/data/layouts/#{str}"
|
"#{File.expand_path(File.dirname(__FILE__))}/data/layouts/#{str}"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue