Class: Transpec::CommitMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/transpec/commit_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(report, rspec_version, cli_args = []) ⇒ CommitMessage

Returns a new instance of CommitMessage.



7
8
9
10
11
# File 'lib/transpec/commit_message.rb', line 7

def initialize(report, rspec_version, cli_args = [])
  @report = report
  @rspec_version = rspec_version
  @cli_args = cli_args
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/transpec/commit_message.rb', line 13

def to_s
  conversion_summary = @report.summary(bullet: '*', separate_by_blank_line: true)

  <<-END.gsub(/^\s+\|/, '').chomp
    |Convert specs to RSpec #{@rspec_version} syntax with Transpec
    |
    |This conversion is done by Transpec #{Transpec::Version} with the following command:
    |    transpec #{@cli_args.join(' ')}
    |
    |#{conversion_summary}
  END
end