tags:

views:

14

answers:

0

I am working on a Subversion library and the first step is the checkout method. I have written a test for it that fails with the following error, which I do not understand. Can you help me figure out what happens?

test_Checkout(SvnTest):
NoMethodError: undefined method ` ' for #<Subversion:0x1054e6438>
    lib/svn.rb:23:in `checkout'
    /test/unit/svn_test.rb:18:in `test_Checkout'

Row 23 is: @ctx.checkout(@source.project.repo_url, @source.full_path).

require 'svn/core'
require 'svn/client'
require 'svn/wc'
require 'svn/repos'
require 'svn/info'
require 'svn/error'

class Subversion

  def initialize(source)
    raise "You most provide a valid Source as argument!" unless source.class == Source

    @source = source

    @ctx = Svn::Client::Context.new()
    @ctx.add_simple_provider
    @ctx.auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = @source.username
    @ctx.auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_PASSWORD] = @source.password
  end

  def checkout
    begin
      @ctx.checkout(@source.repo_url, @source.local_path)
    rescue Svn::Error::RaNotAuthorized => e
      return { :error => "The credentials you saved for this account are not valid." }
    end
  end

end

Thank you in advance.