Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. RSpec.configure do |config|
  2. config.use_transactional_fixtures = false
  3.  
  4. config.before(:suite) do
  5. DatabaseCleaner.clean_with(:truncation)
  6. end
  7.  
  8. config.before(:each) do |example|
  9. DatabaseCleaner.strategy= example.metadata[:js] ? :truncation : :transaction
  10. DatabaseCleaner.start
  11. end
  12.  
  13. config.after(:each) do
  14. DatabaseCleaner.clean
  15. end
  16. end
  17.  
  18. FactoryGirl.define do
  19. factory :post, :class => MyEngine::Post do
  20. title 'title'
  21. end
  22. end
  23.  
  24. require 'spec_helper'
  25.  
  26. describe 'Post', :type => :feature do
  27. let(:post) { FactoryGirl.create :post }
  28.  
  29. it 'index action should have post' do
  30. visit posts_path
  31. expect(page).to have_text(post.title)
  32. end
  33. end
  34.  
  35. INSERT INTO "my_engine_posts" ...
  36. RELEASE SAVEPOINT active_record_1
  37. rollback transaction
  38.  
  39. expect(page).to have_text(post.title)
  40.  
  41. require 'spec_helper'
  42.  
  43. describe 'Post', :type => :feature do
  44. let(:post) { FactoryGirl.create :post }
  45.  
  46. it 'index action should have post' do
  47. post
  48. visit posts_path
  49. expect(page).to have_text(post.title)
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement