Module: Hecks::Behaviors::RSpec

Defined in:
lib/hecks/behaviors/rspec.rb

Class Method Summary collapse

Class Method Details

.describe_file(path) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/hecks/behaviors/rspec.rb', line 22

def describe_file(path)
  parsed = Behaviors.parse(path)

  ::RSpec.describe(File.basename(path)) do
    if parsed.parse_error
      it "loads without a parse error" do
        raise parsed.parse_error
      end
    else
      parsed.suite.tests.each do |test|
        it(test.description) do
          run = Expectations.run_one(test, parsed.suite)
          raise run.message if run.status != :pass
        end
      end
    end
  end
end