Ruby - Capybara - ArgumentError: invalid keys - ruby

I'm executing a code, where i verify if the input is disabled, but an error occurs.
CODE
before(:each) do
visit 'https://training-wheels-protocol.herokuapp.com/dynamic_controls'
end
it 'quando habilita o campo' do
res = page.has_field? 'movie', disable: true
puts res
end
ERROR
ArgumentError:
invalid keys :disable, should be one of :count, :minimum, :maximum, :between, :text, :id, :class, :style, :visible, :exact, :exact_text, :normalize_ws, :match, :wait, :filter_set, :checked, :unchecked, :disabled, :multiple, :readonly, :with, :type, :name, :placeholder
# ./spec/dynamic_control_spec.rb:8:in `block (2 levels) in <top (required)>'
Can someone help me?

The error message is telling you what options are valid to pass to has_field?. You should be passing disabled: true rather than :disable.

Related

null validation failed when attribute supplied rom-rb

I'm trying to get to grips with the rom-rb persistence library, using sqlite3.
I ran the following migration, which includes a NOT NULL constraint:
ROM::SQL.migration do
change do
create_table :users do
primary_key :id
column :name, String, null: false
column :age, Integer
column :is_admin, TrueClass
end
end
end
Here's my simple app.rb:
require 'rom'
rom = ROM.container(:sql, 'sqlite://db/my-db-file.db') do |config|
class Users < ROM::Relation[:sql]
schema(infer: true)
end
config.relation(:users)
end
users = rom.relations[:users]
puts users.to_a.inspect # => []
create_user = users.command(:create)
create_user.call( name: 'Rob', age: 30, is_admin: true )
puts users.to_a.inspect # never reached
Trying to run this script produced the following output:
Roberts-MacBook-Pro:my-rom-demo Rob$ ruby app.rb
[]
/Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `step': SQLite3::ConstraintException: NOT NULL constraint failed: users.name (ROM::SQL::NotNullConstraintError)
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `block in each'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `loop'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `each'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:156:in `to_a'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:156:in `block in execute'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:95:in `prepare'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in `execute'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/adapters/sqlite.rb:189:in `block (2 levels) in _execute'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/database/logging.rb:38:in `log_connection_yield'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/adapters/sqlite.rb:189:in `block in _execute'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/database/connecting.rb:253:in `block in synchronize'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/connection_pool/threaded.rb:91:in `hold'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/database/connecting.rb:253:in `synchronize'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/adapters/sqlite.rb:180:in `_execute'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/adapters/sqlite.rb:146:in `execute_insert'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/dataset/actions.rb:1099:in `execute_insert'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/sequel-5.11.0/lib/sequel/dataset/actions.rb:399:in `insert'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-sql-2.5.0/lib/rom/sql/relation/writing.rb:39:in `insert'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-sql-2.5.0/lib/rom/sql/commands/create.rb:46:in `block in insert'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-sql-2.5.0/lib/rom/sql/commands/create.rb:46:in `map'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-sql-2.5.0/lib/rom/sql/commands/create.rb:46:in `insert'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-sql-2.5.0/lib/rom/sql/commands/create.rb:31:in `execute'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-core-4.2.1/lib/rom/command.rb:280:in `call'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-sql-2.5.0/lib/rom/sql/commands/error_wrapper.rb:16:in `call'
from /Rob.rvm/gems/ruby-2.4.0#learn-rails/gems/rom-core-4.2.1/lib/rom/commands/composite.rb:17:in `call'
from app.rb:15:in `<main>'
Why does it think my name attribute is null when I'm providing it?
NOTE: I revised my answer after some testing and learning about ops gem versions
The reason you're getting a NULL CONSTRAINT error is because ROM does not
have a schema loaded for the the users table.
When you defined the container below
rom = ROM.container(:sql, 'sqlite://db/my-db-file.db') do |config|
class Users < ROM::Relation[:sql]
schema(infer: true)
end
config.relation(:users)
end
you defined two things, a relation class bound to a constant called Users and an auto generated relation with the same name but is actually registered inside the ROM container. Effectively the Users constant relation is being ignored. The reason this is important is because the auto generated relation isn't automatically inferring the schema from the database so when you go to write data out, the schema forces all of the unknown keys to be removed causing the error. All you're sending to the db is {}.
To fix the error just tell the relation to infer the schema - an example can be seen below.
require 'rom'
require 'rom/sql'
require 'sqlite3'
puts "ROM Version #{ROM::Core::VERSION}" # 4.2.1
puts "ROM Version #{ROM::SQL::VERSION}" # 2.5.0
puts "Sequel Version #{Sequel::VERSION}" # 5.11.0
puts "SQLite3 Gem Version #{SQLite3::VERSION}" # 1.3.13
opts = {
adapter: :sqlite,
database: 'c:/mydb.db'
}
rom = ROM.container(:sql, opts) do |c|
# Just another way to write the same users table
# c.gateways[:default].create_table(:users) do
# column :id, :integer, primary_key: true
# column :name, :string, null: false
# column :age, :integer
# column :is_admin, :bool
# end
c.gateways[:default].create_table :users do
primary_key :id
column :name, String, null: false
column :age, Integer
column :is_admin, TrueClass
end
c.relation(:users) do
schema(infer: true)
end
end
users = rom.relations[:users]
puts users.to_a.inspect # => []
create_user = users.command(:create)
create_user.call(name: 'Rob', age: 30, is_admin: true)
puts users.to_a.inspect # never reached
# Uncomment if you want to see the users schema
# puts users.dataset.db.schema(:users)
If you want to use standalone relation classes instead of the container config dsl then I suggest reading up on the Auto Registration system.
DATABASE CREATION ISSUE
There is a whole host of things that could be going on which could prevent a sqlite database from being created.
It could be a permissions issue
The directory structure might not exist
Sqlite might not be compiled to handle URI's (only matters if you are using file:// in your paths) [see sqlite docs]
My advice here is when working with sqlite and ROM, use the opts hash example from the script above and try and use a relative path from the current working directory. That seems to always work.

Why my ruby tests does not pass?

I have the following table TodoList :
class CreateTodoLists < ActiveRecord::Migration
def change
create_table :todo_lists do |t|
t.string :list_name
t.date :list_due_date
t.timestamps null: false
end
end
end
I create crud methods:
def create_todolist(params)
todolist = TodoList.create(params)
end
And i have the followging tests:
context "the code has to create_todolist method" do
it { is_expected.to respond_to(:create_todolist) }
it "should create_todolist with provided parameters" do
expect(TodoList.find_by list_name: "mylist").to be_nil
due_date=Date.today
assignment.create_todolist(:name=> 'mylist', :due_date=>due_date)
testList = TodoList.find_by list_name: 'mylist'
expect(testList.id).not_to be_nil
expect(testList.list_name).to eq "mylist"
expect(testList.list_due_date).to eq due_date
expect(testList.created_at).not_to be_nil
expect(testList.updated_at).not_to be_nil
end
end
When i launch the test give me the following errors:
assignment code has create_todolist method should create_todolist with provided parameters
Failure/Error: assignment.create_todolist(:name=> 'mylist', :due_date=>due_date)
ActiveRecord::UnknownAttributeError:
unknown attribute 'name' for TodoList.
# ./assignment/assignment.rb:25:in `create_todolist'
# ./spec/assignment_spec.rb:171:in `block (4 levels) in <top (required)>'
# ./spec/assignment_spec.rb:14:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# NoMethodError:
# undefined method `name=' for #<TodoList:0x007f96dd0d13f0>
# ./assignment/assignment.rb:25:in `create_todolist'
Finished in 0.14136 seconds (files took 1.66 seconds to load)
2 examples, 1 failure
Failed examples:
rspec ./spec/assignment_spec.rb:168 # Assignment rq03 rq03.2 assignment code has create_todolist method should create_todolist with provided parameters
I think it's because params attributes does not match exactly the same TodoList attributes. How to modify my create_todolist to change keys values ?
Your field is called list_name, but you're passing :name => 'myList'.
The same for due_date and list_due_date.
Should be
assignment.create_todolist(list_name:'mylist', list_due_date: due_date)

Undefined method error while running rspec test

All,
I am getting the following undefined method errors below when running my rspec tests. When I have gotten this error before I had a method misspelled or my order of execution caused it. I checked both along with some other posts on StackOverflow, but nothing helped. Can anyone offer any guidance?
Rspec Failures:
FFFF
Failures:
1) Post vote methods #up_votes counts the number of votes with value = 1
Failure/Error: expect(#post.up_votes ).to eq(3)
NoMethodError:
undefined method `up_votes' for #<Post:0x007fe92f381a38>
# ./spec/models/post_spec.rb:14:in `block (4 levels) in <top (required)>'
2) Post vote methods #down_votes counts the number of votes with values = -1
Failure/Error: expect(#post.down_votes ).to eq(2)
NoMethodError:
undefined method `down_votes' for #<Post:0x007fe92a18c228>
# ./spec/models/post_spec.rb:20:in `block (4 levels) in <top (required)>'
3) Post vote methods #points returns the sum of all down and up votes
Failure/Error: expect(#post.points ).to eq(1) # 3 - 2
NoMethodError:
undefined method `points' for #<Post:0x007fe92986c620>
# ./spec/models/post_spec.rb:26:in `block (4 levels) in <top (required)>'
4) Vote validations value validation only allows -1 or 1 as values
Failure/Error: expect(#post.up_votes).to eq((-1) || eq(1))
NoMethodError:
undefined method `up_votes' for nil:NilClass
# ./spec/models/vote_spec.rb:5:in `block (4 levels) in <top (required)>'
Post_rspec
require 'rails_helper'
describe Post do
describe "vote methods" do
before do
#post = Post.create(title: 'Post title', body: 'Post bodies must be pretty long.')
3.times { #post.votes.create(value: 1) }
2.times { #post.votes.create(value: -1) }
end
describe '#up_votes' do
it "counts the number of votes with value = 1" do
expect(#post.up_votes ).to eq(3)
end
end
describe '#down_votes' do
it "counts the number of votes with values = -1" do
expect(#post.down_votes ).to eq(2)
end
end
describe '#points' do
it "returns the sum of all down and up votes" do
expect(#post.points ).to eq(1) # 3 - 2
end
end
end
end
vote_spec file
describe Vote do
describe "validations" do
describe "value validation" do
it "only allows -1 or 1 as values" do
expect(#post.up_votes).to eq((-1) || eq(1))
end
end
end
end
Post.rb
class Post < ActiveRecord::Base
has_many :comments, dependent: :destroy
has_many :votes
has_one :summary
belongs_to :user #means the post table has the user table's primary key in it
belongs_to :topic
mount_uploader :avatar, AvatarUploader
default_scope {order('created_at DESC')}
validates :title, length: {minimum: 5}, presence: true
validates :body, length: {minimum: 20}, presence: true
def markdown_title
(render_as_markdown).render(self.title).html_safe
end
def markdown_body
(render_as_markdown).render(self.body).html_safe
end
private
def render_as_markdown
renderer = Redcarpet::Render::HTML.new
extensions = {fenced_code_blocks: true}
redcarpet = Redcarpet::Markdown.new(renderer, extensions)
#return redcarpet
end
end
For the post_spec.rb errors, check the Post model (see file app/models/post.rb) has the following methods defined in it:
up_votes
down_votes
points
Consider including the code for post.rb in your original question too.
For the vote_spec.rb errors, there is no #post variable, it will be nil. This error message hints at this:
Failure/Error: expect(#post.up_votes).to eq((-1) || eq(1))
NoMethodError: undefined method `up_votes' for nil:NilClass

Strange behavior in rspec when raising exception

I am trying to figure out why the following spec won't pass when the expect and actual results look the same
1) Moodle::Client raises moodle error if token is invalid
Failure/Error: expect {
expected Moodle::MoodleError with {"exception"=>"moodle_exception", "errorcode"=>"invalidtoken", "message"=>"Invalid token - token not found"}, got #<Moodle::MoodleError: {"exception"=>"moodle_exception", "errorcode"=>"invalidtoken", "message"=>"Invalid token - token not found"}> with backtrace:
# ./lib/moodle/client.rb:27:in `resolve_request'
# ./lib/moodle/client.rb:11:in `method_missing'
# ./spec/moodle/client_spec.rb:48:in `block (4 levels) in <module:Moodle>'
# ./spec/moodle/client_spec.rb:47:in `block (3 levels) in <module:Moodle>'
# /Users/ryanme/.rvm/gems/ruby-2.2.2#phoenix/gems/vcr-2.9.3/lib/vcr/util/variable_args_block_caller.rb:9:in `call'
# /Users/ryanme/.rvm/gems/ruby-2.2.2#phoenix/gems/vcr-2.9.3/lib/vcr/util/variable_args_block_caller.rb:9:in `call_block'
# /Users/ryanme/.rvm/gems/ruby-2.2.2#phoenix/gems/vcr-2.9.3/lib/vcr.rb:182:in `use_cassette'
# ./spec/moodle/client_spec.rb:46:in `block (2 levels) in <module:Moodle>'
# ./spec/moodle/client_spec.rb:47:in `block (3 levels) in <module:Moodle>'
# /Users/ryanme/.rvm/gems/ruby-2.2.2#phoenix/gems/vcr-2.9.3/lib/vcr/util/variable_args_block_caller.rb:9:in `call'
# /Users/ryanme/.rvm/gems/ruby-2.2.2#phoenix/gems/vcr-2.9.3/lib/vcr/util/variable_args_block_caller.rb:9:in `call_block'
# /Users/ryanme/.rvm/gems/ruby-2.2.2#phoenix/gems/vcr-2.9.3/lib/vcr.rb:182:in `use_cassette'
# ./spec/moodle/client_spec.rb:46:in `block (2 levels) in <module:Moodle>'
The code is still work in progress:
require 'typhoeus'
module Moodle
class Client
attr_reader :web_service_name, :filter_params
def method_missing message, *args, &block
if supports_web_service? message
#web_service_name = message
#filter_params = args.first
resolve_request
else
super
end
end
def supports_web_service? name
true # change to look at configuration for web services
end
def resolve_request
response = request.run
json_body = JSON.parse(response.body)
if json_body['exception']
raise MoodleError, json_body
else
json_body
end
end
def request
Typhoeus::Request.new(Moodle.configuration.api_url,
method: :post,
params: request_params,
headers: { 'Accept' => "json" })
end
def request_params
filter_params.merge!({ moodlewsrestformat: Moodle.configuration.format,
wsfunction: web_service_name,
wstoken: Moodle.configuration.token })
end
end
end
The spec spec is below:
it 'raises moodle error if token is invalid' do
Moodle.configure do|c|
c.host = 'http://dev.vle.getsmarter.co.za'
c.token = 'invalidtoken'
end
expected_response = {"exception"=>"moodle_exception","errorcode"=>"invalidtoken","message"=>"Invalid token - token not found"}
VCR.use_cassette("valid_service_with_invalid_token") do
expect {
Moodle::Client.new.core_user_get_users(params)
}.to raise_error(Moodle::MoodleError, expected_response)
end
end
My question is why is it breaking? Does it have something to do with the backtrace? Also any ideas on how to fix it would be great.
raise_error doesn't take a hash but an error message (either string or regexp).
This would work:
expect {
Moodle::Client.new.core_user_get_users(params)
}.to raise_error(Moodle::MoodleError, 'Invalid token - token not found')
You can set additional expectations by passing a block, e.g.:
expect {
Moodle::Client.new.core_user_get_users(params)
}.to raise_error(Moodle::MoodleError, 'Invalid token - token not found') { |error|
expect(error.errorcode).to eq('invalidtoken')
}

Strange problem with factory girl

I have a model
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# name :string(255)
# title :string(255)
# content :text
# created_at :datetime
# updated_at :datetime
# abstract :text
# category_id :integer
# finalversion :boolean default(FALSE)
# published_date :date
#
class Post < ActiveRecord::Base
has_many :tags
belongs_to :category
validates :published_date, :presence => true
default_scope :order => 'created_at DESC'
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
def prev_post
self.class.first(:conditions => ["id < ?", id], :order => "id desc")
end
def next_post
self.class.first(:conditions => ["id > ?", id], :order => "id asc")
end
def seo_title
title.gsub(/\s+/,'_')
end
end
and a factory
FactoryGirl.define do
factory :post do
published_date Date.today
association :category, :factory => :category
title Forgery::LoremIpsum.words
name Forgery::LoremIpsum.word
content Forgery::LoremIpsum.words(100, :random => 250)
abstract Forgery::LoremIpsum.words(100, :random => 50)
finalversion true
end
end
and in the rails console I have no problem doing
FactoryGirl.create :post
to get a valid object and am able to access the *published_date* attribute. However in my spec
require 'spec_helper'
(1..5).map do |i|
title = "a title\t#{i}"
escape_title = "a_title_#{i}"
perma_link = "/posts/#{i}/title/#{escape_title}"
describe "A post with title '#{title}'" do
before do
#post = FactoryGirl.create :post, :id=>i, :title => title
visit '/posts'
end
it "should appear in all links with permalink #{perma_link}" do
within "section.post_#{#post.id}" do
page.should have_xpath(%Q%.//h1/a[#href="#{perma_link}"]%)
within "div.teaser" do
page.should have_xpath(%Q%.//a[#href="#{perma_link}"]%)
end
end
end
end
end
I get the backtrace error
5) A post with title 'a title 5' should appear in all links with permalink /posts/5/title/a_title_5
Failure/Error: #post = FactoryGirl.create :post, :id=>i, :title => title
NoMethodError:
undefined method `published_date=' for #<Post:0x000001047266b8>
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:364:in `method_missing'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:46:in `method_missing'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/proxy/build.rb:13:in `set'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/attribute/static.rb:12:in `add_to'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/factory.rb:93:in `block in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/factory.rb:91:in `each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/factory.rb:91:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/syntax/methods.rb:54:in `create'
# ./spec/integration/posts_permalinks_spec.rb:12:in `block (3 levels) in <top (required)>'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:29:in `instance_eval'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:29:in `run_in'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `block in run_all'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `run_all'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:110:in `run_hook'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `block in eval_before_eachs'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `eval_before_eachs'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:144:in `run_before_each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:48:in `block (2 levels) in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:106:in `with_around_hooks'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:46:in `block in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:99:in `block in with_pending_capture'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:98:in `catch'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:98:in `with_pending_capture'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:45:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:262:in `block in run_examples'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:258:in `map'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:258:in `run_examples'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:232:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `block (2 levels) in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `map'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `block in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/reporter.rb:12:in `report'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:24:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun'
I'm totally stumped on it. Any ideas
Brad
Did you run rake db:test:prepare? It looks to me like your Post model has published_date, but your Factory is saying it doesn't exist. Not running this rake task would be the major thing that would cause this.

Resources