David Chelimsky wrote: > On 8/27/07, Jay Levitt <[EMAIL PROTECTED]> wrote: >> Tilmann Singer wrote: >>> * Jay Levitt <[EMAIL PROTECTED]> [20070827 03:51]: >>>> What's rake doing differently? >>> rake spec isn't doing anything fundamentally different, but the order >>> the specs are run is propably randomly different from when you run >>> them with spec so they happen to pass in one case and fail in the >>> other. >> Nope, it's definitely not random - script/spec works every time, rake >> fails every time. > > By default, the spec.opts file, which is loaded w/ the rake task, but > not implicitly with the script/spec command, uses --reverse, so the > files are run in reverse order. That would support Tilmann's theory > combined with your observation that they consistently pass one way and > fail the other.
Nope: # lib/tasks/jaytest.rake rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib') $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) require 'spec/rake/spectask' require 'spec/translator' desc "Run my bad spec" Spec::Rake::SpecTask.new(:jaytest) do |t| t.spec_files = FileList['spec/models/jaytest_spec.rb'] end # spec/models/jaytest_spec.rb require File.dirname(__FILE__) + '/../spec_helper' describe User, "in fixture :quentin" do fixtures :users it "should" do @user = users(:quentin) end end # mysql>show create table accounts .. CONSTRAINT `accounts_opener_id_fk` FOREIGN KEY (`opener_id`) REFERENCES `users` (`id`) .. # 'rake jaytest' output F 1) ActiveRecord::StatementInvalid in 'User in fixture :quentin should' Mysql::Error: Cannot delete or update a parent row: a foreign key constraint fails (`mediajoint_development/accounts`, CONSTRAINT `accounts_opener_id_fk` FOREIGN KEY (`opener_id`) REFERENCES `users` (`id`)): DELETE FROM users /Users/jay/Documents/eclipse/mediajoint/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/model.rb:12:in `before_eval' Finished in 0.031189 seconds 1 example, 1 failure rake aborted! Command ruby -I"/Users/jay/Documents/eclipse/mediajoint/vendor/plugins/rspec/lib" "/Users/jay/Documents/eclipse/mediajoint/vendor/plugins/rspec/bin/spec" "spec/models/jaytest_spec.rb" failed # ruby -I"/Users/jay/Documents/eclipse/mediajoint/vendor/plugins/rspec/lib" "/Users/jay/Documents/eclipse/mediajoint/vendor/plugins/rspec/bin/spec" "spec/models/jaytest_spec.rb" output _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users