Permalink
Browse files

Update to rspec 2. The rake tasks aren't quite worked out (e.g. parse…

…r-specific suites don't run), but the base suite runs.
  • Loading branch information...
1 parent dd3aa96 commit 1481ee30db12a886569267e0d6d21218e9f14bc8 @Empact Empact committed Oct 22, 2010
Showing with 21 additions and 23 deletions.
  1. 0 spec/spec.opts → .rspec
  2. +11 −13 Rakefile
  3. +6 −6 spec/definition_spec.rb
  4. +1 −1 spec/roxml_spec.rb
  5. +1 −1 spec/shared_specs.rb
  6. +2 −2 spec/xml/namespace_spec.rb
File renamed without changes.
View
@@ -25,7 +25,7 @@ EOF
gem.add_dependency 'activesupport', '>= 3.0.0'
gem.add_dependency 'nokogiri', '>= 1.3.3'
- gem.add_development_dependency "rspec"
+ gem.add_development_dependency "rspec", '>= 2.0.0'
gem.add_development_dependency "sqlite3-ruby", '>= 1.2.4'
gem.add_development_dependency "activerecord", '>= 3.0.0'
end
@@ -56,30 +56,28 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end
-require 'spec/rake/spectask'
+require 'rspec/core/rake_task'
desc "Run specs"
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec' << 'examples'
- spec.spec_opts = ['--options', "spec/spec.opts"]
- spec.spec_files = FileList['spec/**/*_spec.rb']
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.ruby_opts = '-Ilib -Ispec -Iexamples'
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
end
namespace :spec do
[:libxml, :nokogiri].each do |parser|
desc "Spec ROXML under the #{parser} parser"
- Spec::Rake::SpecTask.new(parser) do |spec|
- spec.libs << 'lib' << 'spec' << 'examples'
- spec.spec_opts = ['--options=spec/spec.opts']
- spec.spec_files = ["spec/support/#{parser}.rb"] + FileList['spec/**/*_spec.rb']
+ RSpec::Core::RakeTask.new(parser) do |spec|
+ spec.ruby_opts = '-Ilib -Ispec -Iexamples'
+ # spec.spec_files = ["spec/support/#{parser}.rb"] + FileList['spec/**/*_spec.rb']
end
end
end
desc "Run specs with rcov"
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.pattern = 'spec/**/*_spec.rb'
+RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.rcov = true
+ spec.ruby_opts = '-Ilib -Ispec -Iexamples'
+ # spec.spec_files = FileList['spec/**/*_spec.rb']
end
require 'rake/testtask'
View
@@ -13,7 +13,7 @@
end
end
- describe "DateTime reference", :shared => true do
+ shared_examples_for "DateTime reference" do
it "should return nil on empty string" do
@subject.blocks.first.call(" ").should be_nil
end
@@ -29,7 +29,7 @@
end
end
- describe "Date reference", :shared => true do
+ shared_examples_for "Date reference" do
it "should return nil on empty string" do
@subject.blocks.first.call(" ").should be_nil
end
@@ -128,7 +128,7 @@ def self.from_xml(val)
end
describe "=> {}" do
- describe "hash options declaration", :shared => true do
+ shared_examples_for "hash options declaration" do
it "should represent a hash" do
@opts.hash?.should be_true
end
@@ -210,7 +210,7 @@ def self.from_xml(val)
proc { ROXML::Definition.new(:count, :as => :foat) }.should raise_error(ArgumentError)
end
- describe "block shorthand type declaration", :shared => true do
+ shared_examples_for "block shorthand type declaration" do
it "should translate nil to nil" do
@definition.blocks.first.call(nil).should be_nil
end
@@ -390,7 +390,7 @@ def self.from_xml(val)
end
describe ":from" do
- describe "attribute reference", :shared => true do
+ shared_examples_for "attribute reference" do
it "should be interpreted as :attr" do
@opts.sought_type.should == :attr
end
@@ -450,7 +450,7 @@ def self.from_xml(val)
describe "options" do
- describe "boolean option", :shared => true do
+ shared_examples_for "boolean option" do
it "should be recognized" do
ROXML::Definition.new(:author, :from => :content, @option => true).respond_to?(:"#{@option}?")
ROXML::Definition.new(:author, :from => :content, @option => true).send(:"#{@option}?").should be_true
View
@@ -1,7 +1,7 @@
require_relative './spec_helper'
describe ROXML, "#from_xml" do
- describe "from_xml call", :shared => true do
+ shared_examples_for "from_xml call" do
it "should fetch values" do
book = BookWithContributors.from_xml(@path)
book.title.should == "Programming Ruby - 2nd Edition"
View
@@ -1,6 +1,6 @@
require_relative './spec_helper'
-describe "freezable xml reference", :shared => true do
+shared_examples_for "freezable xml reference" do
describe "with :frozen option" do
it "should be frozen" do
@frozen.frozen?.should be_true
@@ -57,7 +57,7 @@ class VApp
end
end
- describe "roxml namespacey declaration", :shared => true do
+ shared_examples_for "roxml namespacey declaration" do
context "with a namespacey :from" do
context "and an explicit :namespace" do
it "should raise" do
@@ -83,7 +83,7 @@ class VApp
end
end
- describe "roxml namespacey declaration with default", :shared => true do
+ shared_examples_for "roxml namespacey declaration with default" do
it_should_behave_like "roxml namespacey declaration"
it "should use the default namespace" do

0 comments on commit 1481ee3

Please sign in to comment.