Jason Swett
Jason Swett

Reputation: 45174

Inexplicable error when running tests

I get this error when I try to run rake test:profile. The error is coming from test_homepage which is in this file:

require 'test_helper'
require 'rails/performance_test_help'

# Profiling results for each test method are written to tmp/performance.
class BrowsingTest < ActionDispatch::PerformanceTest
  def test_homepage
    get '/'
  end
end

I don't understand why running this test has anything to do with creating a bank. Can anyone explain what's going on?

Upvotes: 0

Views: 193

Answers (2)

pjammer
pjammer

Reputation: 9577

I'd assume this is a fresh test suite and you haven't updated your fixtures/bank.yml file with real data and you may actually have an ID field in it too, maybe?

Without seeing that fixture it's all guess work, but take a look at that.

Upvotes: 0

jerhinesmith
jerhinesmith

Reputation: 15500

Are you using fixtures? If so, double check to see that data in your fixtures aren't violating a uniqueness constraint on one (or more) of your database tables.

I've had this issue before when creating a table with a unique index:

create_table "companies" do |t|
  t.string   "name"
  t.text     "description"
end

add_index "companies", "name", :unique => true

By default, the fixture for this model would get generated with non-unique data for the name attribute.

Upvotes: 1

Related Questions