Module: Kernel

Defined in:
lib/smartest/dsl.rb

Instance Method Summary collapse

Instance Method Details

#around_suite {|suite| ... } ⇒ void

This method returns an undefined value.

Register a hook that wraps the whole suite.

The block receives a ‘Smartest::SuiteRun` object and must call `suite.run` exactly once.

Yield Parameters:



# File 'lib/smartest/dsl.rb', line 68

#around_test {|test| ... } ⇒ void

This method returns an undefined value.

Register a hook that wraps tests declared after this hook in the same file.

The block receives a ‘Smartest::TestRun` object and must call `test.run` exactly once. The hook wraps fixture setup, the test body, and fixture teardown.

Yield Parameters:



# File 'lib/smartest/dsl.rb', line 68

#test(name, **metadata) { ... } ⇒ void

This method returns an undefined value.

Define a named Smartest test.

Fixture values are requested with required keyword block parameters:

test("opens the home page") do |page:|
  page.goto("/")
end

Smartest installs this method by prepending ‘Smartest::DSL` into Kernel, so it overrides Ruby’s built-in ‘Kernel#test` file-test helper while Smartest tests are being loaded.

Parameters:

  • name (String, Symbol)

    human-readable test name

  • metadata (Hash)

    optional metadata kept with the test case

Yields:

  • test body; required keyword parameters request fixtures



# File 'lib/smartest/dsl.rb', line 68