features/support/env.rb in active_cucumber-0.0.1 vs features/support/env.rb in active_cucumber-0.0.2
- old
+ new
@@ -1,16 +1,21 @@
require 'active_record'
require 'sqlite3'
require 'mortadella'
require 'active_cucumber'
+require 'factory_girl'
+require 'faker'
+require 'kappamaki'
+require 'rspec/collection_matchers'
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:'
)
+
ActiveRecord::Schema.define do
create_table :shows, force: true do |t|
t.string :name
t.datetime 'created_at'
end
@@ -21,9 +26,28 @@
t.integer :year
t.datetime 'created_at'
end
end
+
+FactoryGirl.define do
+ factory :show do
+ name { Faker::Book.title }
+ end
+
+ factory :episode do
+ name { Faker::Book.title }
+ year { 1960 + rand(40) }
+ show
+ end
+end
+
+
Before do
Show.delete_all
Episode.delete_all
+ @error_checked = false
+end
+
+After do
+ expect(@error_happened).to be false unless @error_checked
end