diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..092760a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: ruby +sudo: false +services: + - mysql +before_script: + - "bundle exec rake db:create" +before_install: + - gem install bundler +script: "bundle exec rake spec" +env: + - "ADAPTER=in_memory" +# - "ADAPTER=yaml" + - "ADAPTER=sqlite" + - "ADAPTER=mysql DM_DB_USER=root DM_DB_PASSWORD=''" +rvm: + - 1.9.3 + - 2.0.0 + - 2.1.5 + - 2.2.0 diff --git a/Gemfile b/Gemfile index 8c2de53..9c14d53 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,14 @@ require 'pathname' -source :rubygems +source 'https://rubygems.org' gemspec SOURCE = ENV.fetch('SOURCE', :git).to_sym REPO_POSTFIX = SOURCE == :path ? '' : '.git' DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper' -DM_VERSION = '~> 1.3.0.beta' -DO_VERSION = '~> 0.10.6' +DM_VERSION = '~> 1.2' +DO_VERSION = '~> 0.10.15' DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ] CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master') diff --git a/dm-aggregates.gemspec b/dm-aggregates.gemspec index fcc9f1b..a9dde0a 100644 --- a/dm-aggregates.gemspec +++ b/dm-aggregates.gemspec @@ -7,6 +7,7 @@ Gem::Specification.new do |gem| gem.summary = "DataMapper plugin providing support for aggregates on collections" gem.description = gem.summary gem.homepage = "http://datamapper.org" + gem.license = 'MIT' gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- {spec}/*`.split("\n") @@ -16,8 +17,8 @@ Gem::Specification.new do |gem| gem.require_paths = [ "lib" ] gem.version = DataMapper::Aggregates::VERSION - gem.add_runtime_dependency('dm-core', '~> 1.3.0.beta') + gem.add_runtime_dependency('dm-core', '~> 1.2') - gem.add_development_dependency('rake', '~> 0.9.2') - gem.add_development_dependency('rspec', '~> 1.3.2') + gem.add_development_dependency('rake', '~> 10.0') + gem.add_development_dependency('rspec', '~> 3.0') end diff --git a/lib/dm-aggregates/version.rb b/lib/dm-aggregates/version.rb index 25d0bf1..977cd75 100644 --- a/lib/dm-aggregates/version.rb +++ b/lib/dm-aggregates/version.rb @@ -1,5 +1,5 @@ module DataMapper module Aggregates - VERSION = '1.3.0.beta' + VERSION = '1.2.0' end end diff --git a/spec/isolated/require_after_setup_spec.rb b/spec/isolated/require_after_setup_spec.rb index 1a97d4f..0ea4410 100644 --- a/spec/isolated/require_after_setup_spec.rb +++ b/spec/isolated/require_after_setup_spec.rb @@ -1,6 +1,4 @@ -require 'backports' -require 'spec' - +require 'rspec' require 'isolated/require_spec' require 'dm-core/spec/setup' @@ -9,14 +7,14 @@ if %w[ postgres mysql sqlite oracle sqlserver ].include?(ENV['ADAPTER']) - describe "require 'dm-aggregates after calling DataMapper.setup" do + RSpec.describe "require 'dm-aggregates after calling DataMapper.setup" do before(:all) do @adapter = DataMapper::Spec.adapter require 'dm-aggregates' end - it_should_behave_like "require 'dm-aggregates'" + include_examples "require 'dm-aggregates'" end diff --git a/spec/isolated/require_before_setup_spec.rb b/spec/isolated/require_before_setup_spec.rb index 592618e..6a399a7 100644 --- a/spec/isolated/require_before_setup_spec.rb +++ b/spec/isolated/require_before_setup_spec.rb @@ -1,6 +1,4 @@ -require 'backports' -require 'spec' - +require 'rspec' require 'isolated/require_spec' require 'dm-core/spec/setup' @@ -9,14 +7,14 @@ if %w[ postgres mysql sqlite oracle sqlserver ].include?(ENV['ADAPTER']) - describe "require 'dm-aggregates' before calling DataMapper.setup" do + RSpec.describe "require 'dm-aggregates' before calling DataMapper.setup" do before(:all) do require 'dm-aggregates' @adapter = DataMapper::Spec.adapter end - it_should_behave_like "require 'dm-aggregates'" + include_examples "require 'dm-aggregates'" end diff --git a/spec/isolated/require_spec.rb b/spec/isolated/require_spec.rb index 8ef75d3..6b5bdb8 100644 --- a/spec/isolated/require_spec.rb +++ b/spec/isolated/require_spec.rb @@ -1,13 +1,13 @@ -shared_examples_for "require 'dm-aggregates'" do +RSpec.shared_examples_for "require 'dm-aggregates'" do %w[ Repository Model Collection Query ].each do |name| it "should include the aggregate api in DataMapper::#{name}" do - (DataMapper.const_get(name) < DataMapper::Aggregates.const_get(name)).should be(true) + expect(DataMapper.const_get(name) < DataMapper::Aggregates.const_get(name)).to be(true) end end it "should include the aggregate api into the adapter" do - @adapter.respond_to?(:aggregate).should be(true) + expect(@adapter.respond_to?(:aggregate)).to be(true) end end diff --git a/spec/public/collection_spec.rb b/spec/public/collection_spec.rb index bfcdb50..3f9a67d 100644 --- a/spec/public/collection_spec.rb +++ b/spec/public/collection_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe DataMapper::Collection do +RSpec.describe DataMapper::Collection do supported_by :sqlite, :mysql, :postgres do let(:dragons) { Dragon.all } let(:countries) { Country.all } - it_should_behave_like 'It Has Setup Resources' - it_should_behave_like 'An Aggregatable Class' + include_examples 'It Has Setup Resources' + include_examples 'An Aggregatable Class' describe 'ignore invalid query' do let(:dragons) { Dragon.all.all(:id => []) } @@ -15,38 +15,38 @@ describe "##{method}" do subject { dragons.send(method) } - it { should == 0 } + it { is_expected.to eq(0) } end end describe '#min' do subject { dragons.min(:id) } - it { should be_nil } + it { is_expected.to be_nil } end describe '#max' do subject { dragons.max(:id) } - it { should be_nil } + it { is_expected.to be_nil } end describe '#avg' do subject { dragons.avg(:id) } - it { should be_nil } + it { is_expected.to be_nil } end describe '#sum' do subject { dragons.sum(:id) } - it { should be_nil } + it { is_expected.to be_nil } end describe '#aggregate' do subject { dragons.aggregate(:id) } - it { should == [] } + it { is_expected.to eq([]) } end end @@ -56,43 +56,43 @@ describe '#size' do subject { collection.size } - it { should == 2 } + it { is_expected.to eq(2) } end describe '#count' do subject { collection.count } - it { should == 2 } + it { is_expected.to eq(2) } end describe '#min' do subject { collection.min(:toes_on_claw) } - it { should == 3 } + it { is_expected.to eq(3) } end describe '#max' do subject { collection.max(:toes_on_claw) } - it { should == 4 } + it { is_expected.to eq(4) } end describe '#avg' do subject { collection.avg(:toes_on_claw) } - it { should == 3.5 } + it { is_expected.to eq(3.5) } end describe '#sum' do subject { collection.sum(:toes_on_claw) } - it { should == 7 } + it { is_expected.to eq(7) } end describe '#aggregate' do subject { collection.aggregate(:all.count, :name.count, :toes_on_claw.min, :toes_on_claw.max, :toes_on_claw.avg, :toes_on_claw.sum)} - it { should == [ 2, 2, 3, 4, 3.5, 7 ] } + it { is_expected.to eq([ 2, 2, 3, 4, 3.5, 7 ]) } end end @@ -102,13 +102,17 @@ describe '#size' do subject { dragons.size } - it { should == 1 } + it { is_expected.to eq(1) } end describe '#count' do subject { dragons.count } - it { pending('TODO: make count apply to the limited collection. Currently limit applies after the count') { should == 1 } } + it do + pending('TODO: make count apply to the limited collection. Currently limit applies after the count') + is_expected.to eq(1) + end + end end @@ -118,7 +122,7 @@ let(:dragons) { Dragon.all(:order => [ :birth_at.desc ]) } it 'displays the results in reverse order' do - should == Dragon.aggregate(:birth_at, :all.count).reverse + is_expected.to eq(Dragon.aggregate(:birth_at, :all.count).reverse) end end end diff --git a/spec/public/model_spec.rb b/spec/public/model_spec.rb index 447cbfb..3568d56 100644 --- a/spec/public/model_spec.rb +++ b/spec/public/model_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe DataMapper::Model do +RSpec.describe DataMapper::Model do supported_by :sqlite, :mysql, :postgres do let(:dragons) { Dragon } let(:countries) { Country } - it_should_behave_like 'It Has Setup Resources' - it_should_behave_like 'An Aggregatable Class' + include_examples 'It Has Setup Resources' + include_examples 'An Aggregatable Class' end end diff --git a/spec/public/shared/aggregate_shared_spec.rb b/spec/public/shared/aggregate_shared_spec.rb index d3df6f6..e6686ed 100644 --- a/spec/public/shared/aggregate_shared_spec.rb +++ b/spec/public/shared/aggregate_shared_spec.rb @@ -1,9 +1,7 @@ -shared_examples_for 'It Has Setup Resources' do +RSpec.shared_examples_for 'It Has Setup Resources' do before :all do @mysql = defined?(DataMapper::Adapters::MysqlAdapter) && @adapter.kind_of?(DataMapper::Adapters::MysqlAdapter) @postgres = defined?(DataMapper::Adapters::PostgresAdapter) && @adapter.kind_of?(DataMapper::Adapters::PostgresAdapter) - - @skip = (@mysql || @postgres) && ENV['TZ'].to_s.downcase != 'utc' end before :all do @@ -81,27 +79,27 @@ end end -shared_examples_for 'An Aggregatable Class' do +RSpec.shared_examples_for 'An Aggregatable Class' do describe '#size' do - it_should_behave_like 'count with no arguments' + include_examples 'count with no arguments' end describe '#count' do - it_should_behave_like 'count with no arguments' + include_examples 'count with no arguments' context 'with a property name' do it 'counts the results' do - dragons.count(:name).should == 2 + expect(dragons.count(:name)).to eq(2) end it 'counts the results with conditions having operators' do - dragons.count(:name, :toes_on_claw.gt => 3).should == 1 + expect(dragons.count(:name, :toes_on_claw.gt => 3)).to eq(1) end it 'counts the results with raw conditions' do statement = 'is_fire_breathing = ?' - dragons.count(:name, :conditions => [ statement, false ]).should == 1 - dragons.count(:name, :conditions => [ statement, true ]).should == 1 + expect(dragons.count(:name, :conditions => [ statement, false ])).to eq(1) + expect(dragons.count(:name, :conditions => [ statement, true ])).to eq(1) end end end @@ -115,41 +113,39 @@ context 'with a property name' do it 'provides the lowest value of an Integer property' do - dragons.min(:toes_on_claw).should == 3 - countries.min(:population).should == 82369548 + expect(dragons.min(:toes_on_claw)).to eq(3) + expect(countries.min(:population)).to eq(82369548) end it 'provides the lowest value of a Float property' do - countries.min(:birth_rate).should be_kind_of(Float) - countries.min(:birth_rate).should >= 7.87 - @approx_by # approx match - countries.min(:birth_rate).should <= 7.87 + @approx_by # approx match + expect(countries.min(:birth_rate)).to be_kind_of(Float) + expect(countries.min(:birth_rate)).to be >= 7.87 - @approx_by # approx match + expect(countries.min(:birth_rate)).to be <= 7.87 + @approx_by # approx match end it 'provides the lowest value of a BigDecimal property' do - countries.min(:gold_reserve_value).should be_kind_of(BigDecimal) - countries.min(:gold_reserve_value).should == BigDecimal('1217050983400.0') + expect(countries.min(:gold_reserve_value)).to be_kind_of(BigDecimal) + expect(countries.min(:gold_reserve_value)).to eq(BigDecimal('1217050983400.0')) end it 'provides the lowest value of a DateTime property' do - pending_if 'TODO: returns incorrect value until DO handles TZs properly', @skip do - dragons.min(:birth_at).should be_kind_of(DateTime) - dragons.min(:birth_at).to_s.should == @birth_at.to_s - end + expect(dragons.min(:birth_at)).to be_kind_of(DateTime) + expect(dragons.min(:birth_at).to_s).to eq(@birth_at.to_s) end it 'provides the lowest value of a Date property' do - dragons.min(:birth_on).should be_kind_of(Date) - dragons.min(:birth_on).should == @birth_on + expect(dragons.min(:birth_on)).to be_kind_of(Date) + expect(dragons.min(:birth_on)).to eq(@birth_on) end it 'provides the lowest value of a Time property' do - dragons.min(:birth_time).should be_kind_of(Time) - dragons.min(:birth_time).to_s.should == @birth_time.to_s + expect(dragons.min(:birth_time)).to be_kind_of(Time) + expect(dragons.min(:birth_time).to_s).to eq(@birth_time.to_s) end it 'provides the lowest value when conditions provided' do - dragons.min(:toes_on_claw, :is_fire_breathing => true).should == 4 - dragons.min(:toes_on_claw, :is_fire_breathing => false).should == 3 + expect(dragons.min(:toes_on_claw, :is_fire_breathing => true)).to eq(4) + expect(dragons.min(:toes_on_claw, :is_fire_breathing => false)).to eq(3) end end end @@ -163,40 +159,38 @@ context 'with a property name' do it 'provides the highest value of an Integer property' do - dragons.max(:toes_on_claw).should == 5 - countries.max(:population).should == 1330044605 + expect(dragons.max(:toes_on_claw)).to eq(5) + expect(countries.max(:population)).to eq(1330044605) end it 'provides the highest value of a Float property' do - countries.max(:birth_rate).should be_kind_of(Float) - countries.max(:birth_rate).should >= 20.04 - @approx_by # approx match - countries.max(:birth_rate).should <= 20.04 + @approx_by # approx match + expect(countries.max(:birth_rate)).to be_kind_of(Float) + expect(countries.max(:birth_rate)).to be >= 20.04 - @approx_by # approx match + expect(countries.max(:birth_rate)).to be <= 20.04 + @approx_by # approx match end it 'provides the highest value of a BigDecimal property' do - countries.max(:gold_reserve_value).should == BigDecimal('22589877164500.0') + expect(countries.max(:gold_reserve_value)).to eq(BigDecimal('22589877164500.0')) end it 'provides the highest value of a DateTime property' do - pending_if 'TODO: returns incorrect value until DO handles TZs properly', @skip do - dragons.min(:birth_at).should be_kind_of(DateTime) - dragons.min(:birth_at).to_s.should == @birth_at.to_s - end + expect(dragons.min(:birth_at)).to be_kind_of(DateTime) + expect(dragons.min(:birth_at).to_s).to eq(@birth_at.to_s) end it 'provides the highest value of a Date property' do - dragons.min(:birth_on).should be_kind_of(Date) - dragons.min(:birth_on).should == @birth_on + expect(dragons.min(:birth_on)).to be_kind_of(Date) + expect(dragons.min(:birth_on)).to eq(@birth_on) end it 'provides the highest value of a Time property' do - dragons.min(:birth_time).should be_kind_of(Time) - dragons.min(:birth_time).to_s.should == @birth_time.to_s + expect(dragons.min(:birth_time)).to be_kind_of(Time) + expect(dragons.min(:birth_time).to_s).to eq(@birth_time.to_s) end it 'provides the highest value when conditions provided' do - dragons.max(:toes_on_claw, :is_fire_breathing => true).should == 5 - dragons.max(:toes_on_claw, :is_fire_breathing => false).should == 3 + expect(dragons.max(:toes_on_claw, :is_fire_breathing => true)).to eq(5) + expect(dragons.max(:toes_on_claw, :is_fire_breathing => false)).to eq(3) end end end @@ -210,26 +204,26 @@ context 'with a property name' do it 'provides the average value of an Integer property' do - dragons.avg(:toes_on_claw).should be_kind_of(Float) - dragons.avg(:toes_on_claw).should == 4.0 + expect(dragons.avg(:toes_on_claw)).to be_kind_of(Float) + expect(dragons.avg(:toes_on_claw)).to eq(4.0) end it 'provides the average value of a Float property' do mean_birth_rate = (13.71 + 14.18 + 16.04 + 11.03 + 7.87 + 20.04 + 8.18) / 7 - countries.avg(:birth_rate).should be_kind_of(Float) - countries.avg(:birth_rate).should >= mean_birth_rate - @approx_by # approx match - countries.avg(:birth_rate).should <= mean_birth_rate + @approx_by # approx match + expect(countries.avg(:birth_rate)).to be_kind_of(Float) + expect(countries.avg(:birth_rate)).to be >= mean_birth_rate - @approx_by # approx match + expect(countries.avg(:birth_rate)).to be <= mean_birth_rate + @approx_by # approx match end it 'provides the average value of a BigDecimal property' do mean_gold_reserve_value = ((600.0 + 8133.50 + 438.20 + 765.20 + 3417.40) * @gold_tonne_price) / 5 - countries.avg(:gold_reserve_value).should be_kind_of(BigDecimal) - countries.avg(:gold_reserve_value).should == BigDecimal(mean_gold_reserve_value.to_s) + expect(countries.avg(:gold_reserve_value)).to be_kind_of(BigDecimal) + expect(countries.avg(:gold_reserve_value)).to eq(BigDecimal(mean_gold_reserve_value.to_s)) end it 'provides the average value when conditions provided' do - dragons.avg(:toes_on_claw, :is_fire_breathing => true).should == 4.5 - dragons.avg(:toes_on_claw, :is_fire_breathing => false).should == 3 + expect(dragons.avg(:toes_on_claw, :is_fire_breathing => true)).to eq(4.5) + expect(dragons.avg(:toes_on_claw, :is_fire_breathing => false)).to eq(3) end end end @@ -243,27 +237,27 @@ context 'with a property name' do it 'provides the sum of values for an Integer property' do - dragons.sum(:toes_on_claw).should == 12 + expect(dragons.sum(:toes_on_claw)).to eq(12) total_population = 1330044605 + 303824646 + 191908598 + 140702094 + 127288419 + 109955400 + 82369548 - countries.sum(:population).should == total_population + expect(countries.sum(:population)).to eq(total_population) end it 'provides the sum of values for a Float property' do total_tonnes = 600.0 + 8133.5 + 438.2 + 765.2 + 3417.4 - countries.sum(:gold_reserve_tonnes).should be_kind_of(Float) - countries.sum(:gold_reserve_tonnes).should >= total_tonnes - @approx_by # approx match - countries.sum(:gold_reserve_tonnes).should <= total_tonnes + @approx_by # approx match + expect(countries.sum(:gold_reserve_tonnes)).to be_kind_of(Float) + expect(countries.sum(:gold_reserve_tonnes)).to be >= total_tonnes - @approx_by # approx match + expect(countries.sum(:gold_reserve_tonnes)).to be <= total_tonnes + @approx_by # approx match end it 'provides the sum of values for a BigDecimal property' do - countries.sum(:gold_reserve_value).should == BigDecimal('37090059214100.0') + expect(countries.sum(:gold_reserve_value)).to eq(BigDecimal('37090059214100.0')) end it 'provides the average value when conditions provided' do - dragons.sum(:toes_on_claw, :is_fire_breathing => true).should == 9 - dragons.sum(:toes_on_claw, :is_fire_breathing => false).should == 3 + expect(dragons.sum(:toes_on_claw, :is_fire_breathing => true)).to eq(9) + expect(dragons.sum(:toes_on_claw, :is_fire_breathing => false)).to eq(3) end end end @@ -278,14 +272,14 @@ context 'with only aggregate fields specified' do it 'provides aggregate results' do results = dragons.aggregate(:all.count, :name.count, :toes_on_claw.min, :toes_on_claw.max, :toes_on_claw.avg, :toes_on_claw.sum) - results.should == [ 3, 2, 3, 5, 4.0, 12 ] + expect(results).to eq([ 3, 2, 3, 5, 4.0, 12 ]) end end context 'with aggregate fields and a property to group by' do it 'provides aggregate results' do results = dragons.aggregate(:all.count, :name.count, :toes_on_claw.min, :toes_on_claw.max, :toes_on_claw.avg, :toes_on_claw.sum, :is_fire_breathing) - results.should == [ [ 1, 1, 3, 3, 3.0, 3, false ], [ 2, 1, 4, 5, 4.5, 9, true ] ] + expect(results).to eq([ [ 1, 1, 3, 3, 3.0, 3, false ], [ 2, 1, 4, 5, 4.5, 9, true ] ]) end end end @@ -293,30 +287,30 @@ describe 'query path issue' do it 'does not break when a query path is specified' do dragon = dragons.first(Dragon.knight.name => 'Chuck') - dragon.name.should == 'George' + expect(dragon.name).to eq('George') end end end -shared_examples_for 'count with no arguments' do +RSpec.shared_examples_for 'count with no arguments' do it 'counts the results' do - dragons.count.should == 3 + expect(dragons.count).to eq(3) - countries.count.should == 7 + expect(countries.count).to eq(7) end it 'counts the results with conditions having operators' do - dragons.count(:toes_on_claw.gt => 3).should == 2 + expect(dragons.count(:toes_on_claw.gt => 3)).to eq(2) - countries.count(:birth_rate.lt => 12).should == 3 - countries.count(:population.gt => 1000000000).should == 1 - countries.count(:population.gt => 2000000000).should == 0 - countries.count(:population.lt => 10).should == 0 + expect(countries.count(:birth_rate.lt => 12)).to eq(3) + expect(countries.count(:population.gt => 1000000000)).to eq(1) + expect(countries.count(:population.gt => 2000000000)).to eq(0) + expect(countries.count(:population.lt => 10)).to eq(0) end it 'counts the results with raw conditions' do dragon_statement = 'is_fire_breathing = ?' - dragons.count(:conditions => [ dragon_statement, false ]).should == 1 - dragons.count(:conditions => [ dragon_statement, true ]).should == 2 + expect(dragons.count(:conditions => [ dragon_statement, false ])).to eq(1) + expect(dragons.count(:conditions => [ dragon_statement, true ])).to eq(2) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9319584..931a946 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,3 @@ -require 'backports' - require 'dm-core/spec/setup' require 'dm-core/spec/lib/adapter_helpers' require 'dm-core/spec/lib/pending_helpers' @@ -9,9 +7,12 @@ require 'public/shared/aggregate_shared_spec' +# Some of the tests fail when TZ is not set, but not when it's blank. Go figure +ENV['TZ'] ||= '' + DataMapper::Spec.setup -Spec::Runner.configure do |config| +RSpec.configure do |config| config.extend(DataMapper::Spec::Adapters::Helpers) config.include(DataMapper::Spec::PendingHelpers) diff --git a/tasks/db.rake b/tasks/db.rake new file mode 100644 index 0000000..ecb1168 --- /dev/null +++ b/tasks/db.rake @@ -0,0 +1,11 @@ +namespace :db do + task :create do + sh 'mysql -uroot -e "CREATE DATABASE IF NOT EXISTS datamapper_default_tests;"' + sh 'mysql -uroot -e "CREATE DATABASE IF NOT EXISTS datamapper_alternate_tests;"' + end + + task :drop do + sh 'mysql -uroot -e "DROP DATABASE IF EXISTS datamapper_default_tests;"' + sh 'mysql -uroot -e "DROP DATABASE IF EXISTS datamapper_alternate_tests;"' + end +end diff --git a/tasks/spec.rake b/tasks/spec.rake index 652b946..45a7860 100644 --- a/tasks/spec.rake +++ b/tasks/spec.rake @@ -1,38 +1,3 @@ -spec_defaults = lambda do |spec| - spec.pattern = 'spec/**/*_spec.rb' - spec.libs << 'lib' << 'spec' - spec.spec_opts << '--options' << 'spec/spec.opts' -end - -begin - require 'spec/rake/spectask' - - Spec::Rake::SpecTask.new(:spec, &spec_defaults) -rescue LoadError - task :spec do - abort 'rspec is not available. In order to run spec, you must: gem install rspec' - end -end - -begin - require 'rcov' - require 'spec/rake/verify_rcov' - - Spec::Rake::SpecTask.new(:rcov) do |rcov| - spec_defaults.call(rcov) - rcov.rcov = true - rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/) - end - - RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov| - rcov.threshold = 100 - end -rescue LoadError - %w[ rcov verify_rcov ].each do |name| - task name do - abort "rcov is not available. In order to run #{name}, you must: gem install rcov" - end - end -end - +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) task :default => :spec