[manifest-commit] [18] trunk/manifest: moving to rspec some more

0 views
Skip to first unread message

ant...@lunar-ocean.com

unread,
Feb 22, 2009, 10:53:05 AM2/22/09
to manife...@googlegroups.com
Revision
18
Author
toulmean
Date
2009-02-22 10:53:05 -0500 (Sun, 22 Feb 2009)

Log Message

moving to rspec some more

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/manifest/Rakefile (17 => 18)


--- trunk/manifest/Rakefile	2009-02-22 15:22:23 UTC (rev 17)
+++ trunk/manifest/Rakefile	2009-02-22 15:53:05 UTC (rev 18)
@@ -47,6 +47,30 @@
   sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
 end
 
+begin
+  require 'spec'
+rescue LoadError
+  require 'rubygems'
+  require 'spec'
+end
+begin
+  require 'spec/rake/spectask'
+rescue LoadError
+  puts <<-EOS
+To use rspec for testing you must install rspec gem:
+    gem install rspec
+EOS
+  exit(0)
+end
+
+desc "Run the specs under spec"
+Spec::Rake::SpecTask.new do |t|
+  t.spec_opts = ['--options', "spec/spec.opts"]
+  t.spec_files = FileList['spec/**/*_spec.rb']
+  t.spec_opts = %w{--format specdoc --loadby mtime --backtrace}    
+  t.spec_opts << '--colour' if $stdout.isatty
+end
+
 namespace :manifest do
   desc 'Recreate Manifest.txt to include ALL files'
   task :refresh do

Added: trunk/manifest/spec/manifest_spec.rb (0 => 18)


--- trunk/manifest/spec/manifest_spec.rb	                        (rev 0)
+++ trunk/manifest/spec/manifest_spec.rb	2009-02-22 15:53:05 UTC (rev 18)
@@ -0,0 +1,25 @@
+# Copyright Antoine Toulme 2008
+
+require File.dirname(__FILE__) + '/spec_helper.rb'
+
+
+describe "Able to parse a manifest" do 
+  
+  before do
+      @sections = Manifest.read(File.open("#{File.dirname(__FILE__)}/manifest_org.eclipse.compare.MF").read)
+  end
+  
+  it "should be able to guess the version number of the manifest" do
+      @sections.first["Manifest-Version"].keys[0].should eql("1.0")
+  end
+  
+  it "should be able to find the value of an attribute embedded in an entry" do  
+    @sections.first["Bundle-SymbolicName"]["org.eclipse.compare"]["singleton"].should eql("true")
+  end
+  
+  it "should be able to find the value of attributes attached to several values in an entry" do
+    @sections.first["Require-Bundle"]["org.eclipse.ui"]["bundle-version"].should eql("\"[3.3.0,4.0.0)\"")
+    @sections.first["Require-Bundle"]["org.eclipse.core.resources"]["bundle-version"].should eql("\"[3.3.0,4.0.0)\"")
+    @sections.first["Require-Bundle"]["org.eclipse.core.expressions"]["bundle-version"].should eql("\"[3.2.0,4.0.0)\"")
+  end
+end

Added: trunk/manifest/spec/spec_helper.rb (0 => 18)


--- trunk/manifest/spec/spec_helper.rb	                        (rev 0)
+++ trunk/manifest/spec/spec_helper.rb	2009-02-22 15:53:05 UTC (rev 18)
@@ -0,0 +1,3 @@
+# Copyright Antoine Toulme 2008
+
+require File.dirname(__FILE__) + '/../lib/manifest'

Deleted: trunk/manifest/spec/test_helper.rb (16 => 18)


--- trunk/manifest/test/test_helper.rb	2008-02-25 09:51:19 UTC (rev 16)
+++ trunk/manifest/spec/test_helper.rb	2009-02-22 15:53:05 UTC (rev 18)
@@ -1,4 +0,0 @@
-# Copyright Antoine Toulme 2008
-
-require 'test/unit'
-require File.dirname(__FILE__) + '/../lib/manifest'

Copied: trunk/manifest/spec/test_helper.rb (from rev 17, trunk/manifest/test/test_helper.rb) (0 => 18)


--- trunk/manifest/spec/test_helper.rb	                        (rev 0)
+++ trunk/manifest/spec/test_helper.rb	2009-02-22 15:53:05 UTC (rev 18)
@@ -0,0 +1,5 @@
+# Copyright Antoine Toulme 2008
+
+require 'rubygems'
+require 'spec'
+require File.dirname(__FILE__) + '/../lib/manifest'

Deleted: trunk/manifest/spec/test_manifest.rb (16 => 18)


--- trunk/manifest/test/test_manifest.rb	2008-02-25 09:51:19 UTC (rev 16)
+++ trunk/manifest/spec/test_manifest.rb	2009-02-22 15:53:05 UTC (rev 18)
@@ -1,19 +0,0 @@
-# Copyright Antoine Toulme 2008
-
-require File.dirname(__FILE__) + '/test_helper.rb'
-
-
-describe "Able to parse a manifest" do 
-  it "should be able to parse a manifest" do
-    File.open("#{File.dirname(__FILE__)}/manifest_org.eclipse.compare.MF") do |file|
-      class << self ; include Manifest ; end
-      sections = read(file.read)
-      sections.first["Manifest-Version"].keys[0].should == "1.0"
-      sections.first["Bundle-SymbolicName"]["org.eclipse.compare"]["singleton"].should == "true"
-      sections.first["Require-Bundle"]["org.eclipse.ui"]["bundle-version"].should == "\"[3.3.0,4.0.0)\""
-      sections.first["Require-Bundle"]["org.eclipse.core.resources"]["bundle-version"].should == "\"[3.3.0,4.0.0)\""
-      sections.first["Require-Bundle"]["org.eclipse.core.expressions"]["bundle-version"].should == "\"[3.2.0,4.0.0)\""
-    end
-  end
-
-end

Copied: trunk/manifest/spec/test_manifest.rb (from rev 17, trunk/manifest/test/test_manifest.rb) (0 => 18)


--- trunk/manifest/spec/test_manifest.rb	                        (rev 0)
+++ trunk/manifest/spec/test_manifest.rb	2009-02-22 15:53:05 UTC (rev 18)
@@ -0,0 +1,25 @@
+# Copyright Antoine Toulme 2008
+
+require File.dirname(__FILE__) + '/test_helper.rb'
+
+
+describe "Able to parse a manifest" do 
+  
+  before do
+      @sections = Manifest.read(File.open("#{File.dirname(__FILE__)}/manifest_org.eclipse.compare.MF").read)
+  end
+  
+  it "should be able to guess the version number of the manifest" do
+      @sections.first["Manifest-Version"].keys[0].should eql("1.0")
+  end
+  
+  it "should be able to find the value of an attribute embedded in an entry" do  
+    @sections.first["Bundle-SymbolicName"]["org.eclipse.compare"]["singleton"].should eql("true")
+  end
+  
+  it "should be able to find the value of attributes attached to several values in an entry" do
+    @sections.first["Require-Bundle"]["org.eclipse.ui"]["bundle-version"].should eql("\"[3.3.0,4.0.0)\"")
+    @sections.first["Require-Bundle"]["org.eclipse.core.resources"]["bundle-version"].should eql("\"[3.3.0,4.0.0)\"")
+    @sections.first["Require-Bundle"]["org.eclipse.core.expressions"]["bundle-version"].should eql("\"[3.2.0,4.0.0)\"")
+  end
+end
Reply all
Reply to author
Forward
0 new messages