Permalink
Browse files

added rspec tasks. fixed specs.

  • Loading branch information...
1 parent 1c0b399 commit 3b5e1e24715c2f1be21cd6be599409ddf1976075 @georgi committed Apr 13, 2009
Showing with 29 additions and 7 deletions.
  1. +25 −2 Rakefile
  2. +2 −3 test/blog_spec.rb
  3. +2 −2 test/post_spec.rb
View
@@ -1,6 +1,28 @@
require 'rake'
require 'rake/rdoctask'
-
+
+begin
+ require 'spec/rake/spectask'
+rescue LoadError
+ puts <<-EOS
+To use rspec for testing you must install the rspec gem:
+ gem install rspec
+EOS
+ exit(0)
+end
+
+desc "Run all specs"
+Spec::Rake::SpecTask.new(:spec) do |t|
+ t.spec_opts = ['-cfs']
+ t.spec_files = FileList['test/**/*_spec.rb']
+end
+
+desc "Print SpecDocs"
+Spec::Rake::SpecTask.new(:doc) do |t|
+ t.spec_opts = ["--format", "specdoc"]
+ t.spec_files = FileList['test/*_spec.rb']
+end
+
desc "Generate RDoc documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers' << '--inline-source' <<
@@ -14,4 +36,5 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
end
end
-
+desc "Run the rspec"
+task :default => :spec
View
@@ -5,9 +5,8 @@
describe Shinmun::Blog do
- TEST_DIR = File.expand_path(File.dirname(__FILE__))
- TEMPLATES_DIR = File.expand_path(TEST_DIR + '/templates')
- REPO = TEST_DIR + '/repo'
+ TEMPLATES_DIR = File.expand_path(File.dirname(__FILE__) + '/templates')
+ REPO = '/tmp/shinmun-test'
before do
FileUtils.rm_rf REPO
View
@@ -17,11 +17,11 @@
END
it 'should parse and dump in the same way' do
- Shinmun::Post.new(:type => 'md').parse(POST).dump.should == (POST)
+ Shinmun::Post.new(:type => 'md', :src => POST).dump.should == (POST)
end
it "should parse the yaml header" do
- post = Shinmun::Post.new(:type => 'md').parse(POST)
+ post = Shinmun::Post.new(:type => 'md', :src => POST)
post.title.should == 'Patroon - a Javascript Template Engine'
post.category.should == 'Javascript'
post.date.should == Date.new(2008,9,9)

0 comments on commit 3b5e1e2

Please sign in to comment.