# bitbucket inherited fixtures rails test
image: ruby:2.5
pipelines:
default:
- step:
caches:
- bundler
script: # Modify the commands below to build your repository.
- cd $BITBUCKET_CLONE_DIR
- apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs ruby-dev libidn11 libidn11-dev yarn
- echo "bundle install"
- bundle install --path vender/bundle
- echo "migrate/seed/test"
- rake db:migrate RAILS_ENV=test
- rake test RAILS_ENV=test
services:
- postgres
- redis
definitions:
services:
redis:
image: redis
postgres:
image: postgres
environment:
POSTGRES_DB: $db_name
POSTGRES_USER: $db_user
POSTGRES_PASSWORD: $db_password
caches:
bundler: vendor/bundle
Above is my pipeline file.
When the pipeline runs after a commit to the master branch, any test that references a fixture, that deals with a model that extends a different model, they fail.
Ex:
class SomeClass < ApplicationRecord
end
class SecondClass < SomeClass
end
So, any test that is trying to find a fixture set in via the active record helper in tests fails:
Example:
Here, I'm trying to make an instance variable named second, by trying to find a SecondClass record, named some_record. This will fail the find the record, and there will be an error thrown in the pipeline output.
second = second_classes(:some_record)
Why is this? Or, how can ensure my tests pass in the Bitbucket Pipeline? They all pass locally.