Class: MakerWebsite::RunRSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/maker_website/run_rspec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ RunRSpec

Returns a new instance of RunRSpec.



16
17
18
# File 'lib/maker_website/run_rspec.rb', line 16

def initialize(file_name)
  @file_name = file_name
end

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name.



10
11
12
# File 'lib/maker_website/run_rspec.rb', line 10

def file_name
  @file_name
end

Class Method Details

.with(file_name:) ⇒ Object



12
13
14
# File 'lib/maker_website/run_rspec.rb', line 12

def self.with(file_name:)
  self.new(file_name).run
end

Instance Method Details

#runObject



20
21
22
23
24
25
# File 'lib/maker_website/run_rspec.rb', line 20

def run
  reporter.register_listener(formatter, *notifications)
  RSpec::Core::Runner.run([spec_file])

  formatter.output_hash
end

#spec_fileObject



27
28
29
# File 'lib/maker_website/run_rspec.rb', line 27

def spec_file
  @spec_file ||= File.expand_path( "stages/#{file_name}", File.dirname(__FILE__))
end