Skip to content

Instantly share code, notes, and snippets.

@bill-transue
Created October 9, 2012 21:15
Show Gist options
  • Select an option

  • Save bill-transue/3861490 to your computer and use it in GitHub Desktop.

Select an option

Save bill-transue/3861490 to your computer and use it in GitHub Desktop.
spec
describe "copying" do
context "within a cabinet_template" do
let (:cabinet_template) { FactoryGirl.create :cabinet_template }
let!(:ports) do
FactoryGirl.create_list(:component,
:with_ports,
:number_of_ports => 1,
:cabinet => cabinet_template).collect(&:ports).reduce(&:+).tap do |ports|
FactoryGirl.create :cable, :connections => ports
end
end
it "should be connected to copied ports" do
new_cabinet = CabinetTemplate.build_from cabinet_template, :name => FactoryGirl.attributes_for(:cabinet_template)[:name]
Port.find_all_by_name(ports.first).last.should be_connected_to(Port.find_all_by_name(ports.second).last)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment