spec/support/model_helpers.rb in warp-1.2.3 vs spec/support/model_helpers.rb in warp-1.3.0
- old
+ new
@@ -1,9 +1,11 @@
module ModelHelpers
def build_model(&blk)
let(:model) do
Class.new(ActiveRecord::Base) do
+ attr_accessor :id
+
def self.name
"TestModel"
end
def self.primary_key
@@ -25,10 +27,10 @@
def self.column(name, sql_type = nil, default = nil, null = true)
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
end
- instance_eval(&blk)
+ instance_eval(&blk) if blk
end
end
end
end
\ No newline at end of file