Module: Opal::RSpec::AsyncHelpers::ClassMethods

Defined in:
opal/opal/rspec/async.rb

Instance Method Summary collapse

Instance Method Details

#async(desc, *args, &block) ⇒ Object

Define an async example method. This should be used instead of it to inform the spec runner that the example will need to wait for an Opal::RSpec::AsyncHelpers#async method to complete the test. Any additional configuration options can be passed to this call, and they just get delegated to the underlying #it call.

Examples:

describe "Some tests" do
  async "should be async" do
    # ... async code
  end

  it "should work with normal tests" do
    expect(1).to eq(1)
  end
end

Parameters:

  • desc (String)

    description



77
78
79
80
# File 'opal/opal/rspec/async.rb', line 77

def async(desc, *args, &block)
  options = ::RSpec::Core::Metadata.build_hash_from(args)
  Opal::RSpec::AsyncExample.register(self, desc, options, block)
end