编写用于访问SVN的Cucumber功能

时间:2010-06-30 03:29:28

标签: ruby svn mocking cucumber

我正在开发一个通过运行命令行SVN来获取信息和导出来访问SVN的工具。

我想写一些Cucumber功能,所以我不必手动测试,但我想模拟SVN访问。

  1. 我应该切换到使用Ruby SVN库,如果是,那么哪一个?

  2. 或者是否有假的svn.exe会提供可编程的响应?

  3. 编辑:

    该工具采用文件路径,查找父级URL的修订版,然后将该修订版的一堆文件和文件夹导出到新目录中。我想写一些类似的东西:

    Given the file "extra1.txt" contains:
    """
    extra1
    """
    
    And the file "file.txt" contains:
    """
    file
    """
    
    And SVN holds the following files at revisions:
    | tests/extras/extra1.txt    | 123 | extra1.txt |
    | tests/path/part05/file.txt | 73  | file.txt   |
    
    When I run "ruby dry_run_create c:\tests\path\part05\file.txt"
    
    Then the file "c:\tests\path\part05\dry_run\extra1.txt" should contain:
    """
    extra1
    """
    
    And the file "c:\tests\path\part05\dry_run\file.txt" should contain:
    """
    file
    """
    

    通过这些示例,我可以永远证明从SVN中提取正确的修订版而无需实际创建存储库。

2 个答案:

答案 0 :(得分:0)

如果您不需要实际测试SVN功能,只需完全模拟调用。

摩卡很适合这个

退房(没有双关语)http://blog.floehopper.org/articles/2006/09/01/mocha-quickstart

答案 1 :(得分:0)