Class: Hobby::Devtools::RSpec
- Inherits:
-
Object
- Object
- Hobby::Devtools::RSpec
- Defined in:
- lib/hobby/devtools/rspec.rb
Instance Attribute Summary collapse
-
#path(string = 'spec/http') ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #app(&block) ⇒ Object
-
#initialize(&block) ⇒ RSpec
constructor
A new instance of RSpec.
Constructor Details
#initialize(&block) ⇒ RSpec
Returns a new instance of RSpec.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hobby/devtools/rspec.rb', line 8 def initialize &block instance_exec &block Dir["#{path}/**/*.yml"].each do |file| test = Hobby::Test.from_file file ::RSpec.describe [test, @app] do before :each do |example| test, app = described_class 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 assert { @report.ok? } end end end end |
Instance Attribute Details
#path(string = 'spec/http') ⇒ Object (readonly)
Returns the value of attribute path.
43 44 45 |
# File 'lib/hobby/devtools/rspec.rb', line 43 def path @path end |
Class Method Details
.describe(&block) ⇒ Object
4 5 6 |
# File 'lib/hobby/devtools/rspec.rb', line 4 def self.describe &block new &block end |
Instance Method Details
#app(&block) ⇒ Object
39 40 41 |
# File 'lib/hobby/devtools/rspec.rb', line 39 def app &block @app = block end |