Skip to content

Instantly share code, notes, and snippets.

Created January 20, 2010 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/282045 to your computer and use it in GitHub Desktop.
Save anonymous/282045 to your computer and use it in GitHub Desktop.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'
require 'authlogic/test_case'
require 'factory_girl'
Spec::Runner.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
end
spec spec/models/user_spec.rb --backtrace
User
using factory created user
should succeed in creating a user from a factory (FAILED - 1)
1)
NoMethodError in 'User using factory created user should succeed in creating a user from a factory'
undefined method `handling_predicate!' for #<Spec::Matchers::Be:0x25d7e2c @args=[:be_valid]>
/Users/dan/projects/rails/webpoll/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb:9:in `__send__'
/Users/dan/projects/rails/webpoll/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb:9:in `initialize'
/Users/dan/projects/rails/webpoll/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb:39:in `new'
/Users/dan/projects/rails/webpoll/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb:39:in `be_valid'
./spec/models/user_spec.rb:32:
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_methods.rb:40:in `instance_eval'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_methods.rb:40:in `execute'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_methods.rb:37:in `execute'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:214:in `run_examples'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:212:in `each'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:212:in `run_examples'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:103:in `run'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:23:in `run'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:22:in `each'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:22:in `run'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:152:in `run_examples'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
/Library/Ruby/Gems/1.8/gems/rspec-1.3.0/bin/spec:5:
/usr/bin/spec:19:in `load'
/usr/bin/spec:19:
Finished in 0.162505 seconds
1 example, 1 failure
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe User do
describe "using factory created user" do
it "should succeed in creating a user from a factory" do
testuser = Factory.create(:user)
testuser.should be_valid
end
end
end
Factory.define :user, :class => User do |u|
u.username "joe"
u.password "blow"
u.password_confirmation "blow"
u.email "joe@example.com"
end
Factory.define :invalid_user, :class => User do |u|
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment