spec/spec_helper.rb in memento-0.4.3 vs spec/spec_helper.rb in memento-0.5.0
- old
+ new
@@ -15,49 +15,55 @@
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'memento'
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
# catch AR schema statements
-$stdout = StringIO.new
+# $stdout = StringIO.new
+RSpec.configure do |config|
+ config.filter_run :focus
+ config.run_all_when_everything_filtered = true
+ config.expect_with(:rspec) { |c| c.syntax = :should }
+end
+
def setup_db
ActiveRecord::Schema.define(:version => 1) do
create_table :projects do |t|
t.column :name, :string
t.column :closed_at, :datetime
t.column :notes, :text
t.references :customer
t.integer :ignore_this
- t.timestamps
+ t.timestamps null: false
end
create_table :users do |t|
t.column :email, :string
t.column :name, :string
- t.timestamps
+ t.timestamps null: false
end
create_table :customers do |t|
t.column :name, :string
- t.timestamps
+ t.timestamps null: false
end
create_table :timestampless_objects do |t|
t.column :name, :string
end
create_table :memento_sessions do |t|
t.references :user
- t.timestamps
+ t.timestamps null: false
end
create_table :memento_states do |t|
t.string :action_type
t.binary :record_data, :limit => 16777215
t.references :record, :polymorphic => true
t.references :session
- t.timestamps
+ t.timestamps null: false
end
end
end
@@ -77,13 +83,13 @@
class Customer < ActiveRecord::Base
has_many :projects
end unless defined?(Customer)
class Project < ActiveRecord::Base
- belongs_to :customer
+ belongs_to :customer, optional: true
memento_changes :ignore => :ignore_this
end unless defined?(Project)
class TimestamplessObject < ActiveRecord::Base
memento_changes
-end unless defined?(TimestamplessObject)
\ No newline at end of file
+end unless defined?(TimestamplessObject)