Skip to content

Instantly share code, notes, and snippets.

@argent-smith
Created September 27, 2011 20:24
Show Gist options
  • Save argent-smith/1246127 to your computer and use it in GitHub Desktop.
Save argent-smith/1246127 to your computer and use it in GitHub Desktop.
Thor #directory issue
Feature: Suspected #directory issue
In order to test #directory behavior
As a Thor user
I want to see whether it expands 'templated' filenames or not
NB: this feature should be run with cucumber/aruba
Background: making the test suite
Given a file named "tester" with:
"""
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
class Tester < Thor
include Thor::Actions
def self.source_root
File.expand_path('templates', File.dirname(__FILE__))
end
desc "test", "do the test"
def test
directory ".", "generated"
end
private
def what_was_here
"what_i_want_to_see"
end
end
Tester.start
"""
And an empty file named "templates/%what_was_here%.txt.tt"
And an empty file named "templates/%what_was_here%_1.txt"
And I run `chmod +x tester`
Scenario: I expect it to create files with correct names
When I run `./tester test`
Then the following files should exist:
| generated/what_i_want_to_see.txt |
| generated/what_i_want_to_see_1.txt |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment