Class: GitHooks::PreCommit::Rspec
- Inherits:
-
Object
- Object
- GitHooks::PreCommit::Rspec
- Defined in:
- lib/git_hooks/pre_commit/rspec.rb
Instance Attribute Summary collapse
-
#git_repository ⇒ Object
readonly
Returns the value of attribute git_repository.
-
#rspec_executor ⇒ Object
readonly
Returns the value of attribute rspec_executor.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(git_repository, rspec_executor) ⇒ Rspec
constructor
A new instance of Rspec.
- #validate ⇒ Object
Constructor Details
#initialize(git_repository, rspec_executor) ⇒ Rspec
Returns a new instance of Rspec.
12 13 14 |
# File 'lib/git_hooks/pre_commit/rspec.rb', line 12 def initialize(git_repository, rspec_executor) @git_repository, @rspec_executor = git_repository, rspec_executor end |
Instance Attribute Details
#git_repository ⇒ Object (readonly)
Returns the value of attribute git_repository.
4 5 6 |
# File 'lib/git_hooks/pre_commit/rspec.rb', line 4 def git_repository @git_repository end |
#rspec_executor ⇒ Object (readonly)
Returns the value of attribute rspec_executor.
4 5 6 |
# File 'lib/git_hooks/pre_commit/rspec.rb', line 4 def rspec_executor @rspec_executor end |
Class Method Details
.validate ⇒ Object
6 7 8 9 10 |
# File 'lib/git_hooks/pre_commit/rspec.rb', line 6 def self.validate new( GitHooks.configurations.git_repository, RspecExecutor.new ).validate end |
Instance Method Details
#validate ⇒ Object
16 17 18 19 20 |
# File 'lib/git_hooks/pre_commit/rspec.rb', line 16 def validate return if git_repository.clean? abort 'Prevented broken commit' if rspec_executor.errors? end |