spec/rgraph/node_spec.rb in rgraph-0.0.15 vs spec/rgraph/node_spec.rb in rgraph-0.1.1

- old
+ new

@@ -1,23 +1,25 @@ require_relative '../../lib/rgraph/node' describe Node do subject { Node.new(name: "Lucas", id: '1', age: 20) } - describe "#new" do - its(:name) { should eq "Lucas" } - its(:id) { should eq '1' } - its(:age) { should eq 20 } - end - describe "#degree" do - its(:degree) { should eq 0} + context "#new" do + it "returns its attributes" do + expect(subject[:name]).to eq("Lucas") + expect(subject[:id]).to eq('1') + expect(subject[:age]).to eq(20) + end + it "knows it degree" do + expect(subject.degree).to eq(0) + end end - describe "#has_neighbour" do + context "#has_neighbour" do it "recognizes its neighbour" do n1 = Node.new(id: 1) n2 = Node.new(id: 1) n1.neighbours << n2 - expect(n1.has_neighbour?(n2)).to be_true + expect(n1.has_neighbour?(n2)).to be true end end end