module ActiveCucumber
The main namespace for this gem
Public Class Methods
attributes_for(activerecord_class, cucumber_table, context: {})
click to toggle source
Returns the attributes to create an instance of the given ActiveRecord class that matches the given vertical Cucumber table
# File lib/active_cucumber.rb, line 11 def self.attributes_for activerecord_class, cucumber_table, context: {} builder = ActiveRecordBuilder.new activerecord_class, context builder.attributes_for ActiveCucumber.vertical_table(cucumber_table) end
create_many(activerecord_class, cucumber_table, context: {})
click to toggle source
Creates entries of the given ActiveRecord class specified by the given horizontal Cucumber table
# File lib/active_cucumber.rb, line 19 def self.create_many activerecord_class, cucumber_table, context: {} builder = ActiveRecordBuilder.new activerecord_class, context builder.create_many ActiveCucumber.horizontal_table(cucumber_table) end
create_one(activerecord_class, cucumber_table, context: {})
click to toggle source
Creates an entry of the given ActiveRecord class specified by the given vertical Cucumber table
# File lib/active_cucumber.rb, line 27 def self.create_one activerecord_class, cucumber_table, context: {} builder = ActiveRecordBuilder.new activerecord_class, context builder.create_record ActiveCucumber.vertical_table(cucumber_table) end
diff_all!(clazz, cucumber_table, context: {})
click to toggle source
Verifies that the database table for the given ActiveRecord class matches the given horizontal Cucumber table.
Sorts records by creation date.
# File lib/active_cucumber.rb, line 37 def self.diff_all! clazz, cucumber_table, context: {} cucumparer = Cucumparer.new clazz, cucumber_table, context cucumber_table.diff! cucumparer.to_horizontal_table end
diff_one!(object, cucumber_table, context: {})
click to toggle source
Verifies that the given object matches the given vertical Cucumber table
# File lib/active_cucumber.rb, line 44 def self.diff_one! object, cucumber_table, context: {} cucumparer = Cucumparer.new object.class, cucumber_table, context cucumber_table.diff! cucumparer.to_vertical_table(object) end
horizontal_table(table)
click to toggle source
Returns the given horizontal Cucumber table in standardized format
# File lib/active_cucumber.rb, line 51 def self.horizontal_table table table.hashes end
vertical_table(table)
click to toggle source
Returns the given vertical Cucumber table in standardized format
# File lib/active_cucumber.rb, line 57 def self.vertical_table table table.rows_hash end