Permalink
Browse files

Update to work with RSpec 2.0.0a

  • Loading branch information...
JonathanTron committed Mar 2, 2010
1 parent c3763ef commit f80a710f9e664a76cad56223d5510962395e0a50
View
@@ -4,28 +4,26 @@ require "rake"
begin
require "jeweler"
Jeweler::Tasks.new do |gem|
+ gem.version = "0.2.0"
gem.name = "rspec_sequel_matchers"
gem.summary = %Q{TODO}
gem.email = "team@openhood.com"
gem.homepage = "http://github.com/openhood/rspec_sequel_matchers"
gem.authors = ["Jonathan Tron", "Joseph Halter"]
- gem.add_dependency "rspec", "~> 1.2.3"
- gem.add_dependency "sequel", ">= 3.1.0"
-
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ gem.add_dependency "rspec", ">= 2.0.0.a"
+ gem.add_dependency "sequel", ">= 3.8.0"
end
+ Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
-require "spec/rake/spectask"
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << "lib" << "spec"
- spec.spec_files = FileList["spec/**/*_spec.rb"]
+require "rspec/core/rake_task"
+Rspec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = "spec/**/*_spec.rb"
end
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << "lib" << "spec"
+Rspec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = "spec/**/*_spec.rb"
spec.rcov = true
end
View
@@ -1,4 +0,0 @@
----
-:major: 0
-:minor: 1
-:patch: 2
@@ -2,7 +2,7 @@
describe "have_column_matcher" do
- before :all do
+ before do
define_model :item
end
@@ -2,7 +2,7 @@
describe "have_many_to_many_matcher" do
- before :all do
+ before do
define_model :item
define_model :comment do
many_to_many :items
@@ -2,7 +2,7 @@
describe "have_many_to_one_matcher" do
- before :all do
+ before do
define_model :item
define_model :comment do
many_to_one :item
@@ -2,7 +2,7 @@
describe "have_one_to_many_matcher" do
- before :all do
+ before do
define_model :item do
one_to_many :comments
end
View
@@ -1,4 +1,4 @@
-require "spec"
+require "rspec"
require "rubygems"
require "sequel"
require "sequel/extensions/inflector"
@@ -20,32 +20,32 @@
end
Sequel::Migrator.apply(db, File.join(File.dirname(__FILE__), "migrations"))
-def define_model(model, &block)
- model_name = model.to_s.camelize.to_sym
- table_name = model.to_s.tableize.to_sym
- @defined_models ||= []
- @defined_models << model_name
- klass = Object.const_set model_name, Sequel::Model(table_name)
- klass.class_eval &block if block_given?
+module RspecHelpers
+ def define_model(model, &block)
+ model_name = model.to_s.camelize.to_sym
+ table_name = model.to_s.tableize.to_sym
+ @defined_models ||= []
+ @defined_models << model_name
+ klass = Object.const_set model_name, Sequel::Model(table_name)
+ klass.class_eval &block if block_given?
+ end
end
-Spec::Runner.configure do |config|
- config.include(RspecSequel::Matchers)
-
+Rspec.configure do |c|
+ c.mock_framework = :rspec
+ c.color_enabled = true
+ c.include(RspecHelpers)
+ c.include(RspecSequel::Matchers)
# undefine models defined via define_model (if any)
- config.after(:all) do
- @defined_models.each{|model_name|
- Object.send(:remove_const, model_name)
- }
- @defined_models = nil
- end
-
# truncate all tables between each spec
- config.after(:each) do
+ c.after(:each) do
db = Sequel::Model.db
db.tables.each do |table_name|
db["TRUNCATE #{table_name}"]
end
+ (@defined_models||[]).each do |model_name|
+ Object.send(:remove_const, model_name)
+ end
+ @defined_models = nil
end
-
end
@@ -2,7 +2,7 @@
describe "validate_exact_length_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_format_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_includes_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_integer_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_length_range_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_max_length_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_min_length_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_not_string_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_numeric_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_presence_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate
@@ -2,7 +2,7 @@
describe "validate_unique_matcher" do
- before :all do
+ before do
define_model :item do
plugin :validation_helpers
def validate

0 comments on commit f80a710

Please sign in to comment.