Skip to content

Instantly share code, notes, and snippets.

@scottmessinger

scottmessinger/old_node.rb

Last active Aug 29, 2015
Embed
What would you like to do?
How I imagine the migration stuff happening
class OldNode
def lesson
@lesson ||= Lesson.find(id)
end
def verify_migration
self.verify_field_names
self.verify_sections
end
private
def verify_field_names
raise unless lesson.title == self.title
raise unless lesson.sections == self.sections
end
def verify_sections
lesson.sections.each_with_index do |section, index|
raise unless section[:title] == self.sections[index][:title]
end
end
end
describe OldNode
before(:each) do
# somewhere you generate an oldNode. Either form a factory,
# inline (a la OldNode.new(...) or from an import.
@old_node = TommyMagic.generate(:node)
end
it "should verify the field names" do
old_node.migrate
expect{old_node.verify_migration}.to_not raise_error
end
end
@scottmessinger

This comment has been minimized.

Copy link
Owner Author

@scottmessinger scottmessinger commented Sep 8, 2014

Oh! You might want to create models I haven't. E.g. a section model and a parts model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.