CodePadawans / ataru

MIT License
37 stars 3 forks source link

Setup modules #37

Closed schultyy closed 10 years ago

schultyy commented 10 years ago

As a user I want to provide a Ruby file which includes the dependencies for the code examples in markdown files. This is needed for code examples which are not self contained. Self contained in this context means they use classes, modules, methods which are defined in other Ruby files.

This code example in README.md calls a method which is defined elsewhere:

#README.md
```
cat = make_cat
cat #=> =^.^=
```

cats.rb:

#cats.rb
def make_cat
  "=^.^="
end

So to make this code example working, the user needs to provide a setup file which includes cats.rb. Then the method make_cat is callable in the example.

The setup module could look like this:

# my_setup.rb

module MySetup
# here you include the file which is used in README.md
  require 'cats'
end

Passing a setup file from the command line looks like this:

$ ataru getting_started.md awesome_feature.md cats.md --setup my_setup.rb

At first, all markdown files which should be tested are passed. Then comes a new parameter, called —setup. This is followed by the setup file’s name.

The setup module is applied to all code examples which are going to be tested. The MiniTest class generated from CodeSamples should include the setup module in the Application class.

schultyy commented 10 years ago

User story here means, you can create more smaller tasks from this issue :)

madziaf commented 10 years ago

aha, you mean more issues?

schultyy commented 10 years ago

yes :)

schultyy commented 10 years ago

A user story often describes on a high level what should be done and then you create more concrete tasks from this.

moonglum commented 10 years ago

This story does not specify what the setup file is supposed to do, when it will be required and how the module will be made available. Will it be included in the main context?

schultyy commented 10 years ago

yes, right. Will fix :)

emig commented 10 years ago

closed by merge df35b66d37ff8d8dafdca4cdb0d192fc838ad385 from pull request