Class: AgentC::TestHelpers::DummyGit

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_c/test_helpers.rb

Overview

DummyGit for testing git operations without actual git commands Use this by passing it as the git parameter to Pipeline.call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workspace_dir) ⇒ DummyGit

Returns a new instance of DummyGit.



139
140
141
142
# File 'lib/agent_c/test_helpers.rb', line 139

def initialize(workspace_dir)
  @workspace_dir = workspace_dir
  @invocations = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **params) ⇒ Object



160
161
162
163
164
165
166
# File 'lib/agent_c/test_helpers.rb', line 160

def method_missing(method, *args, **params)
  @invocations << {
    method:,
    args:,
    params:,
  }
end

Instance Attribute Details

#invocationsObject (readonly)

Returns the value of attribute invocations.



137
138
139
# File 'lib/agent_c/test_helpers.rb', line 137

def invocations
  @invocations
end

Instance Method Details

#commit_all(message) ⇒ Object



148
149
150
151
152
153
154
# File 'lib/agent_c/test_helpers.rb', line 148

def commit_all(message)
  @invocations << {
    method: :commit_all,
    args: [message],
    params: {}
  }
end

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


168
169
170
# File 'lib/agent_c/test_helpers.rb', line 168

def respond_to_missing?(method, include_private = false)
  true
end

#simulate_file_created!Object



156
157
158
# File 'lib/agent_c/test_helpers.rb', line 156

def simulate_file_created!
  @has_changes = true
end

#uncommitted_changes?Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/agent_c/test_helpers.rb', line 144

def uncommitted_changes?
  @has_changes ||= false
end