lib/kernel.rb in fix-1.0.0.beta4 vs lib/kernel.rb in fix-1.0.0.beta5
- old
+ new
@@ -1,9 +1,30 @@
# frozen_string_literal: true
+require_relative File.join("fix", "doc")
+require_relative File.join("fix", "dsl")
+require_relative File.join("fix", "test")
+
+# The Kernel module.
module Kernel
+ # Specifications are built with this method.
+ #
+ # @example Fix 42 such as it must be equal to 42.
+ # Fix :Answer do
+ # it { MUST equal 42 }
+ # end
+ #
+ # @param name [String, Symbol] The name of the specification document.
+ # @param block [Proc] The specifications.
+ #
+ # @return [Class] The specification document.
+ #
# rubocop:disable Naming/MethodName
- def Fix(subject = nil, **lets, &block)
- ::Fix.describe(subject, **lets, &block)
+ def Fix(name, &block)
+ klass = ::Class.new(::Fix::Dsl)
+ klass.const_set(:SPECS, [klass])
+ klass.instance_eval(&block)
+ ::Fix::Doc.const_set(name, klass)
+ ::Fix::Test.new(name)
end
# rubocop:enable Naming/MethodName
end