spec/rubabel/atom_spec.rb in rubabel-0.2.0 vs spec/rubabel/atom_spec.rb in rubabel-0.2.1
- old
+ new
@@ -3,11 +3,11 @@
require 'rubabel/molecule'
require 'rubabel/atom'
describe Rubabel::Atom do
- it 'can be created given an element symbol' do
+ xit 'can be created given an element symbol' do
hydrogen = Rubabel::Atom[:h]
hydrogen.el.should == :h
carbon = Rubabel::Atom[:c]
carbon.el.should == :c
@@ -15,10 +15,23 @@
chlorine = Rubabel::Atom[:cl, 3]
chlorine.el.should == :cl
chlorine.id.should == 3
end
+ describe 'attaching another atom to itself (as part of a molecule)' do
+
+ it 'attaches preformed atom' do
+ end
+
+ it 'attaches given an atomic number' do
+ end
+
+ it 'attaches given an element symbol' do
+ end
+
+ end
+
specify 'equality' do
mol = Rubabel["CCO"]
oxygen = mol.atoms[2]
oxygen_from_match = mol.matches("CO").first.last
(oxygen == oxygen_from_match).should be_true
@@ -74,27 +87,32 @@
it "has #{methd}" do
@atom.send(methd).should == exp
end
end
+ specify '#<<(atom) adds an atom and returns the added atom' do
+ mol = Rubabel["C"]
+ reply = (mol[0] << :n << :o)
+ reply.should be_a(Rubabel::Atom)
+ mol.csmiles.should == 'CNO'
+ end
it '#mol retrieves the parent molecule' do
@atom.mol.should == @mol
- # no parent molecule
- h = Rubabel::Atom[:h]
- h.mol.should be_nil
+ ## no parent molecule
+ #h = Rubabel::Atom[:h]
+ #h.mol.should be_nil
end
it 'can get the bonds' do
@atom.each_bond do |bond|
bond.should be_a(Rubabel::Bond)
end
@atom.bonds.size.should == 4
end
- it 'can add a bond' do
- end
+ it 'can add a bond'
it 'can get the neighboring atoms' do
@atom.id.should == 0
@atom.atomic_num.should == 6
@atom.type.should == 'C3'