Sha256: 943da5d532f2cfdecadef2d3c50971b8792164ff5ddc92e9c9390a8e04ef5e6a
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
module AllureRSpec module DSL ALLOWED_ATTACH_EXTS = %w[txt html xml png jpg json] def __mutex @@__mutex ||= Mutex.new end def __current_step if defined? @@__current_step @@__current_step else nil end end def __with_step(step, &block) __mutex.synchronize do @@__current_step = step yield @@__current_step = nil end end def step(step, &block) suite = self.example.metadata[:example_group][:description_args].first test = self.example.metadata[:description] AllureRSpec::Builder.start_step(suite, test, step) __with_step step, &block AllureRSpec::Builder.stop_step(suite, test, step) end def attach_file(title, file) step = __current_step suite = self.example.metadata[:example_group][:description_args].first test = self.example.metadata[:description] type = :other file_extname = File.extname(file.path.downcase) type = file_extname if ALLOWED_ATTACH_EXTS.include?(file_extname) AllureRSpec::Builder.add_attachment(suite, test, {:type => type, :title => title, :source => file.path}, step) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
allure-rspec-0.2 | lib/allure-rspec/dsl.rb |
allure-rspec-0.1 | lib/allure-rspec/dsl.rb |