jnicklas/turnip

Support for fixtures

Closed this issue · 6 comments

There is any way to use fixtures with turnip?

If there is, we should add some help to README, if not, consider it a feature request :)

Hi @sobrinho

What is fixtures ? Like test(sample) data for Rails or other ?

Yes, that one.

We can make a test case like that on rails:

# users.yaml
john:
  name: John Doe
  age: 30
# users_spec.rb
describe User do
  fixtures :users

  it 'creates a record' do
    expect(users(:john).name).to eq 'John Doe'
  end
end

This scenario do not makes sense, just the idea :)

Thanks and I understood.

Hmm.. No idea too.


BTW, Your code looks good compatible with the simplybusiness/rutabaga.

What I'm currently doing is configuring the global fixtures as all, which loads all the fixtures in every test case.

But that tends to slow down the suite since the database will grow up sometime later:

RSpec.configure do |config|
  config.global_fixtures = :all
end

Rutabaga seems interesting, thanks for the tip, I will give it a shot.

Do not makes sense to have this kind of support on turnip (not exactly like that rutabaga, maybe, but in some way)? Fixtures are a pretty common need.

Umm.. Sorry, don't know because I never used Turnip + ActiveRecord Fixtures.
Please advice someone  💦

Please consider use pure RSpec when use fixtures.

I've created a wiki page about that: https://github.com/jnicklas/turnip/wiki/Fixtures

Closing :)