projects
/
graph.njae.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2978dd0
)
Added SimpleCov, added tests for Vertex#to_s and Edge#to_s
author
Neil Smith
<neil.github@njae.me.uk>
Wed, 18 Jul 2012 08:31:29 +0000
(09:31 +0100)
committer
Neil Smith
<neil.github@njae.me.uk>
Wed, 18 Jul 2012 08:31:29 +0000
(09:31 +0100)
.gitignore
patch
|
blob
|
history
Gemfile
patch
|
blob
|
history
Gemfile.lock
patch
|
blob
|
history
lib/graph.njae/vertex.rb
patch
|
blob
|
history
spec/graph/edge_spec.rb
patch
|
blob
|
history
spec/graph/vertex_spec.rb
patch
|
blob
|
history
spec/spec_helper.rb
patch
|
blob
|
history
diff --git
a/.gitignore
b/.gitignore
index 63a685ebda4ffd6d68cfe485ed1f4555856f6b98..094d6947a37c51ed7c5ef80e6fd58f151af2eb34 100644
(file)
--- a/
.gitignore
+++ b/
.gitignore
@@
-14,6
+14,9
@@
doc
# jeweler generated
pkg
# jeweler generated
pkg
+# simplecov generated
+coverage
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
#
# * Create a file at ~/.gitignore
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
#
# * Create a file at ~/.gitignore
diff --git
a/Gemfile
b/Gemfile
index df7f77956a3304619972aaaace75c1f412918a07..85b0c68a30b9164e79bcd4c75b8f531501bc3811 100644
(file)
--- a/
Gemfile
+++ b/
Gemfile
@@
-6,7
+6,8
@@
source "http://rubygems.org"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "rspec", "~> 2.8.0"
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.8.0"
+ gem "rspec" # , "~> 2.8.0"
+ gem "bundler" # , "~> 1.0.0"
+ gem "jeweler" # , "~> 1.8.0"
+ gem 'simplecov', :require => false, :group => :test
end
end
diff --git
a/Gemfile.lock
b/Gemfile.lock
index 65179b581c8739a7b66545fc841406fe83edffe0..a0879642329a9d4df4f3e3419dc88310de1b7ca5 100644
(file)
--- a/
Gemfile.lock
+++ b/
Gemfile.lock
@@
-3,28
+3,34
@@
GEM
specs:
diff-lcs (1.1.3)
git (1.2.5)
specs:
diff-lcs (1.1.3)
git (1.2.5)
- jeweler (1.8.
3
)
+ jeweler (1.8.
4
)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
- json (1.6.5)
+ json (1.7.3)
+ multi_json (1.3.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
- rspec (2.8.0)
- rspec-core (~> 2.8.0)
- rspec-expectations (~> 2.8.0)
- rspec-mocks (~> 2.8.0)
- rspec-core (2.8.0)
- rspec-expectations (2.8.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.8.0)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.0)
+ rspec-expectations (2.11.1)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.1)
+ simplecov (0.6.4)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
PLATFORMS
ruby
DEPENDENCIES
PLATFORMS
ruby
DEPENDENCIES
- bundler (~> 1.0.0)
- jeweler (~> 1.8.0)
- rspec (~> 2.8.0)
+ bundler
+ jeweler
+ rspec
+ simplecov
diff --git
a/lib/graph.njae/vertex.rb
b/lib/graph.njae/vertex.rb
index 6e46dcb40029aef8ceca16ad5c5ea2fc5a789c46..aca3fa9aea23baccb74156c6fe8ce29fd3d17477 100644
(file)
--- a/
lib/graph.njae/vertex.rb
+++ b/
lib/graph.njae/vertex.rb
@@
-40,7
+40,7
@@
module GraphNjae
end
def to_s
end
def to_s
- '<V: ' + self.name + '>'
+ '<V: ' + self.name
.to_s
+ '>'
end
end
end
end
diff --git
a/spec/graph/edge_spec.rb
b/spec/graph/edge_spec.rb
index 8fc71ba76c5bfa42b7ee3843e32d144c3a111e5a..f4be16b5e3787353e08e5261133d47f83cc06edb 100644
(file)
--- a/
spec/graph/edge_spec.rb
+++ b/
spec/graph/edge_spec.rb
@@
-25,6
+25,16
@@
module GraphNjae
end
end # adds attributes
end
end # adds attributes
+ describe "#to_s" do
+ it "returns the string form of an edge" do
+ v1 = Vertex.new :name => :v1
+ v2 = Vertex.new :name => :v2
+ e.type = :test
+ e << v1 << v2
+ e.to_s.should == '<E: test [<V: v1>, <V: v2>] >'
+ end
+ end
+
describe "#<<" do
it "adds a new vertex to an edge (with a connection)" do
e.connections.should be_empty
describe "#<<" do
it "adds a new vertex to an edge (with a connection)" do
e.connections.should be_empty
diff --git
a/spec/graph/vertex_spec.rb
b/spec/graph/vertex_spec.rb
index e091289557143377b6f5c7923e3f156b0350ebe0..33b9e0313ea4d360a8cfad9168f464fb2a2a29d7 100644
(file)
--- a/
spec/graph/vertex_spec.rb
+++ b/
spec/graph/vertex_spec.rb
@@
-25,6
+25,14
@@
module GraphNjae
v.score.should == 15
end
end # adds attributes
v.score.should == 15
end
end # adds attributes
+
+ describe "#to_s" do
+ it "returns the string form of a vertex" do
+ v.name = :v1
+ v.to_s.should == '<V: v1>'
+ end
+ end
+
describe "#<<" do
it "adds a single edge between vertices" do
describe "#<<" do
it "adds a single edge between vertices" do
diff --git
a/spec/spec_helper.rb
b/spec/spec_helper.rb
index eacf13a1111c5deca2597a36531cac6a943090b7..608ead7b893277f3dafb59144be0775ccc12172b 100644
(file)
--- a/
spec/spec_helper.rb
+++ b/
spec/spec_helper.rb
@@
-1,12
+1,4
@@
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'rspec'
-require 'graph.njae'
-
-# Requires supporting files with custom matchers and macros, etc,
-# in ./support/ and its subdirectories.
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+require 'simplecov'
+SimpleCov.start
-RSpec.configure do |config|
-
-end
+require 'graph.njae'