Class: Botspec::VerificationTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/botspec/tasks/verification_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, dialogs_path) {|_self| ... } ⇒ VerificationTask

Returns a new instance of VerificationTask.

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
16
# File 'lib/botspec/tasks/verification_task.rb', line 11

def initialize(name, dialogs_path)
  @name = name
  @dialogs_path = dialogs_path
  yield self
  rake_task
end

Instance Attribute Details

#dialogs_pathObject (readonly)

Returns the value of attribute dialogs_path.



9
10
11
# File 'lib/botspec/tasks/verification_task.rb', line 9

def dialogs_path
  @dialogs_path
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/botspec/tasks/verification_task.rb', line 9

def name
  @name
end

Instance Method Details

#rake_taskObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/botspec/tasks/verification_task.rb', line 18

def rake_task
  namespace :botspec do

    desc "Verify botspecs #{name}"
    task "verify:#{name}", :dialog_path do |t, args|
      puts "Running botspecs in #{dialogs_path}"
      BotSpec::BotSpecRunner.run({dialogs_path: dialogs_path, botname: name})

#          config = RSpec.configuration
#          json_formatter = RSpec::Core::Formatters::JsonFormatter.new(config.output_stream)
#
#          # create reporter with json formatter
#          reporter =  RSpec::Core::Reporter.new(json_formatter)
#          # set reporter for rspec configuration
#          config.instance_variable_set(:@reporter, reporter)
#
      # execute rspec runner
      # 'example_spec.rb' is the location of the spec file

      # output test result as json
      # see example output in `rspec_json_formatter_result.rb`
#          puts json_formatter.output_hash

#          RSpec.configure do |config|
#            # Enable flags like --only-failures and --next-failure
#            config.example_status_persistence_file_path = ".rspec_status"
#            config.expose_dsl_globally = true
#
#            # Disable RSpec exposing methods globally on `Module` and `main`
#            config.disable_monkey_patching!
#
#            config.expect_with :rspec do |c|
#              c.syntax = :expect
#            end
#          end
#          BotSpec::RSpec::BotSpecRunner.new().run
#
    end
  end
end