Posted by ch0wda on October 06 2007 at 08:51 AM
On
Gonwodo,
Aaron and I decided to use
RSpec for our tests. We were getting a really strange error when attempting to print out the spec docs through the rake tasks. We had actually never written any specifications, just it “foo foo foo” methods in order to get pending tests. The error we were getting was:
A New User
-- NO NAME (Because of --dry-run)
-- NO NAME (Because of --dry-run)
-- NO NAME (Because of --dry-run)
I was able to determine that the rake task does indeed call dry run. Here’s the task,
1
2
3
4
5
6
|
desc "Print Specdoc for all specs (excluding plugin specs)"
Spec::Rake::SpecTask.new(:doc) do |t|
t.spec_opts = ["--format", "specdoc", "--dry-run"]
t.spec_files = FileList['spec/**/*_spec.rb']
end
|
This is actually the expected behavior, as RSpec is attempting to generate the names of the specs using the code internally. The problem with the dry-run is that it never executes the code so the names cannot be determined. In order to have the empty tests generate the necessary spec doc you would do:
./script/spec spec -fs
I’m not sure that I understand why this is the expected behavior because I give the test a name, so I’m not expecting it to be run. If anyone has an explanation, I would greatly appreciate it.