Class: Hobby::Devtools::RSpec
- Inherits:
-
Object
- Object
- Hobby::Devtools::RSpec
- Defined in:
- lib/hobby/devtools/rspec.rb
Class Method Summary collapse
Instance Method Summary collapse
- #app(&block) ⇒ Object
- #format(format) ⇒ Object
-
#initialize(&block) ⇒ RSpec
constructor
A new instance of RSpec.
- #path(path) ⇒ Object
Constructor Details
#initialize(&block) ⇒ RSpec
Returns a new instance of RSpec.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/hobby/devtools/rspec.rb', line 16 def initialize &block @path = 'spec/http' instance_exec &block Dir["#{@path}/**/*.yml"].each do |file| test = Hobby::Test.from_file file, format: @format ::RSpec.describe(file).instance_exec test, @app do |test, app| before :each do |example| socket = "app.for.#{test}.socket" @pid = fork do server = Puma::Server.new app.call server.add_unix_listener socket server.run sleep end sleep 0.01 until File.exist? socket @report = test[socket] end after(:each) { `kill -9 #{@pid}` } it 'works' do expect(@report).to be_ok end end end end |
Class Method Details
.describe(&block) ⇒ Object
12 13 14 |
# File 'lib/hobby/devtools/rspec.rb', line 12 def self.describe &block new &block end |
Instance Method Details
#app(&block) ⇒ Object
46 47 48 |
# File 'lib/hobby/devtools/rspec.rb', line 46 def app &block @app = block end |
#format(format) ⇒ Object
54 55 56 |
# File 'lib/hobby/devtools/rspec.rb', line 54 def format format @format = format end |
#path(path) ⇒ Object
50 51 52 |
# File 'lib/hobby/devtools/rspec.rb', line 50 def path path @path = path end |