tfs_graph 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +12 -4
- data/Rakefile +1 -0
- data/lib/tfs_graph.rb +1 -2
- data/lib/tfs_graph/abstract_store.rb +23 -0
- data/lib/tfs_graph/associators/branch_associator.rb +1 -1
- data/lib/tfs_graph/associators/changeset_tree_builder.rb +29 -0
- data/lib/tfs_graph/behaviors.rb +9 -0
- data/lib/tfs_graph/behaviors/neo4j_repository/branch.rb +39 -0
- data/lib/tfs_graph/behaviors/neo4j_repository/changeset.rb +12 -0
- data/lib/tfs_graph/behaviors/neo4j_repository/project.rb +89 -0
- data/lib/tfs_graph/behaviors/related_repository/branch.rb +26 -0
- data/lib/tfs_graph/behaviors/related_repository/changeset.rb +8 -0
- data/lib/tfs_graph/behaviors/related_repository/project.rb +48 -0
- data/lib/tfs_graph/branch.rb +84 -37
- data/lib/tfs_graph/branch/branch_archive_handler.rb +10 -6
- data/lib/tfs_graph/branch/branch_store.rb +13 -26
- data/lib/tfs_graph/changeset.rb +46 -25
- data/lib/tfs_graph/changeset/changeset_normalizer.rb +1 -0
- data/lib/tfs_graph/changeset/changeset_store.rb +13 -36
- data/lib/tfs_graph/changeset_merge.rb +20 -18
- data/lib/tfs_graph/changeset_merge/changeset_merge_store.rb +13 -10
- data/lib/tfs_graph/config.rb +12 -4
- data/lib/tfs_graph/entity.rb +34 -6
- data/lib/tfs_graph/extensions.rb +27 -0
- data/lib/tfs_graph/graph_populator.rb +9 -1
- data/lib/tfs_graph/persistable_entity.rb +60 -0
- data/lib/tfs_graph/populators/everything.rb +16 -4
- data/lib/tfs_graph/populators/for_archived_branch.rb +28 -0
- data/lib/tfs_graph/populators/for_branch.rb +35 -0
- data/lib/tfs_graph/populators/for_project.rb +22 -5
- data/lib/tfs_graph/populators/since_date.rb +21 -5
- data/lib/tfs_graph/populators/since_last.rb +22 -10
- data/lib/tfs_graph/populators/utilities.rb +4 -19
- data/lib/tfs_graph/project.rb +49 -13
- data/lib/tfs_graph/project/project_store.rb +13 -22
- data/lib/tfs_graph/repository.rb +78 -0
- data/lib/tfs_graph/repository/neo4j_repository.rb +97 -0
- data/lib/tfs_graph/repository/related_repository.rb +89 -0
- data/lib/tfs_graph/repository_registry.rb +60 -0
- data/lib/tfs_graph/server_registry.rb +45 -0
- data/lib/tfs_graph/store_helpers.rb +4 -5
- data/lib/tfs_graph/version.rb +1 -1
- data/schema.cypher +7 -0
- data/spec/branch_spec.rb +120 -0
- data/spec/neo4j_repository_integration_spec.rb +346 -0
- data/spec/persistable_entity_spec.rb +91 -0
- data/spec/project_spec.rb +29 -0
- data/spec/related_repository_integration_spec.rb +328 -0
- data/spec/repository_registry_spec.rb +48 -0
- data/spec/repository_spec.rb +73 -0
- data/spec/server_registery_spec.rb +36 -0
- data/spec/spec_helper.rb +12 -24
- data/tfs_graph.gemspec +3 -2
- metadata +67 -21
- data/lib/tfs_graph/associators/changeset_tree_creator.rb +0 -19
- data/spec/factories.rb +0 -20
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
require 'tfs_graph/repository'
|
|
4
|
+
require 'tfs_graph/repository/related_repository'
|
|
5
|
+
require 'tfs_graph/server_registry'
|
|
6
|
+
|
|
7
|
+
require 'tfs_graph/branch'
|
|
8
|
+
require 'tfs_graph/project'
|
|
9
|
+
require 'tfs_graph/changeset'
|
|
10
|
+
|
|
11
|
+
describe TFSGraph::Repository do
|
|
12
|
+
context "Related" do
|
|
13
|
+
before :all do
|
|
14
|
+
TFSGraph::ServerRegistry.register {|r|
|
|
15
|
+
r.redis url: "redis://localhost:6379", namespace: "test"
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
before(:each) do
|
|
20
|
+
TFSGraph::ServerRegistry.redis.flushall
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
shared_examples "a repo" do
|
|
24
|
+
context "with related" do
|
|
25
|
+
Given(:repo) { TFSGraph::Repository::RelatedRepository.new type }
|
|
26
|
+
|
|
27
|
+
context "can build an entity (no persist)" do
|
|
28
|
+
When(:object) { repo.build(data) }
|
|
29
|
+
Then { object.should be_a type }
|
|
30
|
+
And { object.should_not be_persisted }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context "can create an entity (persist)" do
|
|
34
|
+
When(:object) { repo.create(data) }
|
|
35
|
+
Then { object.should be_a type }
|
|
36
|
+
And { object.should be_persisted }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "Branch" do
|
|
42
|
+
it_should_behave_like "a repo" do
|
|
43
|
+
Given(:type) { TFSGraph::Branch }
|
|
44
|
+
Given(:data) { {} }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context "Changeset" do
|
|
49
|
+
Given(:type) { TFSGraph::Changeset }
|
|
50
|
+
|
|
51
|
+
it_should_behave_like "a repo" do
|
|
52
|
+
Given(:data) { {} }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context "with changesets" do
|
|
56
|
+
Given(:repo) { TFSGraph::Repository::RelatedRepository.new type }
|
|
57
|
+
Given { 3.times {|i| repo.create({id: i+1, comment: "Commit #{i+1}, Because Tests"}) }}
|
|
58
|
+
|
|
59
|
+
context "can find changesets by id" do
|
|
60
|
+
When(:result) { repo.find 2 }
|
|
61
|
+
Then { result.should_not be_nil }
|
|
62
|
+
And { result.should be_a TFSGraph::Changeset }
|
|
63
|
+
And { result.id.should == 2 }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
context "should raise an error if not found" do
|
|
67
|
+
When(:result) { repo.find 7 }
|
|
68
|
+
Then { result.should have_failed(TFSGraph::Repository::NotFound) }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'tfs_graph/server_registry'
|
|
3
|
+
|
|
4
|
+
describe TFSGraph::ServerRegistry do
|
|
5
|
+
before :each do
|
|
6
|
+
TFSGraph::ServerRegistry.instance.reset!
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
context "should have reasonable defaults" do
|
|
10
|
+
When(:redis) { TFSGraph::ServerRegistry.instance.redis }
|
|
11
|
+
Then { redis.should be_a Redis::Namespace }
|
|
12
|
+
And { redis.namespace.should == "tfs_graph" }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context "should be able to register redis settings" do
|
|
16
|
+
When(:redis) { TFSGraph::ServerRegistry.redis(url: "redis://127.0.0.1:6379", namespace: "foo") }
|
|
17
|
+
Then { redis.namespace.should eq("foo") }
|
|
18
|
+
And { redis.should be_a Redis::Namespace }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context "with a valid config" do
|
|
22
|
+
Given!(:register) { TFSGraph::ServerRegistry.register {|r| r.redis(url: "redis://localhost:6379", namespace: "test") }}
|
|
23
|
+
|
|
24
|
+
context "can call redis on self" do
|
|
25
|
+
When(:redis) { TFSGraph::ServerRegistry.redis }
|
|
26
|
+
Then { redis.should be_a(Redis::Namespace) }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context "can get an instance of redis" do
|
|
30
|
+
When(:redis) { register.redis }
|
|
31
|
+
Then { redis.should be_a(Redis::Namespace) }
|
|
32
|
+
And { redis.namespace.should == "test" }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
$LOAD_PATH.unshift "../lib"
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'simplecov'
|
|
4
|
+
SimpleCov.start do
|
|
5
|
+
add_filter "/spec/"
|
|
6
|
+
end if ENV["COVERAGE"]
|
|
7
|
+
|
|
4
8
|
require 'rspec/given'
|
|
5
9
|
require 'vcr'
|
|
6
|
-
require 'factory_girl'
|
|
7
10
|
require 'pry'
|
|
11
|
+
require 'timecop'
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require 'tfs_graph'
|
|
13
|
+
require "active_support/core_ext/object"
|
|
14
|
+
require 'active_support/core_ext/numeric/time'
|
|
15
|
+
require 'active_support/core_ext/date/calculations'
|
|
13
16
|
|
|
14
17
|
VCR.configure do |c|
|
|
15
18
|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
|
@@ -20,24 +23,9 @@ VCR.configure do |c|
|
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
RSpec.configure do |config|
|
|
23
|
-
config.mock_with :
|
|
24
|
-
config.include FactoryGirl::Syntax::Methods
|
|
25
|
-
|
|
26
|
-
config.before(:each) do
|
|
27
|
-
TFSGraph.config do |c|
|
|
28
|
-
c.tfs = {
|
|
29
|
-
username: 'BFGCOM\apiservice',
|
|
30
|
-
password: "BFGservice123",
|
|
31
|
-
endpoint: "https://tfs-dev-01.bfgdev.inside/RAI"
|
|
32
|
-
}
|
|
33
|
-
c.redis = "localhost:6379/test"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
26
|
+
config.mock_with :flexmock
|
|
36
27
|
|
|
37
|
-
config.after(:
|
|
38
|
-
|
|
39
|
-
r.keys.each do |key|
|
|
40
|
-
r.del key
|
|
41
|
-
end
|
|
28
|
+
config.after(:suite) do
|
|
29
|
+
FileUtils.rm_rf File.join(File.dirname(__FILE__), "tmp", "db", "*")
|
|
42
30
|
end
|
|
43
31
|
end
|
data/tfs_graph.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = ["Luke van der Hoeven"]
|
|
10
10
|
spec.email = ["hungerandthirst@gmail.com"]
|
|
11
11
|
spec.description = %q{A library to help cache and fetch TFS data}
|
|
12
|
-
spec.summary = %q{Simple graph db wrapper for TFS data
|
|
12
|
+
spec.summary = %q{Simple graph db wrapper for TFS data to various backends}
|
|
13
13
|
spec.homepage = ""
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
21
|
spec.add_dependency "ruby_tfs"
|
|
22
|
-
spec.add_dependency "
|
|
22
|
+
spec.add_dependency "activesupport", '~> 4.0'
|
|
23
|
+
spec.add_dependency 'redis-namespace'
|
|
23
24
|
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
|
25
26
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
|
@@ -1,69 +1,83 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tfs_graph
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luke van der Hoeven
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ruby_tfs
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: activesupport
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '4.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '4.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: redis-namespace
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
32
46
|
- !ruby/object:Gem::Version
|
|
33
47
|
version: '0'
|
|
34
48
|
type: :runtime
|
|
35
49
|
prerelease: false
|
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
51
|
requirements:
|
|
38
|
-
- -
|
|
52
|
+
- - ">="
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
54
|
version: '0'
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: bundler
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
44
58
|
requirements:
|
|
45
|
-
- - ~>
|
|
59
|
+
- - "~>"
|
|
46
60
|
- !ruby/object:Gem::Version
|
|
47
61
|
version: '1.3'
|
|
48
62
|
type: :development
|
|
49
63
|
prerelease: false
|
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
65
|
requirements:
|
|
52
|
-
- - ~>
|
|
66
|
+
- - "~>"
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
68
|
version: '1.3'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: rake
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
|
-
- -
|
|
73
|
+
- - ">="
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
75
|
version: '0'
|
|
62
76
|
type: :development
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
|
-
- -
|
|
80
|
+
- - ">="
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
82
|
version: '0'
|
|
69
83
|
description: A library to help cache and fetch TFS data
|
|
@@ -73,16 +87,24 @@ executables: []
|
|
|
73
87
|
extensions: []
|
|
74
88
|
extra_rdoc_files: []
|
|
75
89
|
files:
|
|
76
|
-
- .gitignore
|
|
77
|
-
- .ruby-gemset
|
|
78
|
-
- .ruby-version
|
|
90
|
+
- ".gitignore"
|
|
91
|
+
- ".ruby-gemset"
|
|
92
|
+
- ".ruby-version"
|
|
79
93
|
- Gemfile
|
|
80
94
|
- LICENSE.txt
|
|
81
95
|
- README.md
|
|
82
96
|
- Rakefile
|
|
83
97
|
- lib/tfs_graph.rb
|
|
98
|
+
- lib/tfs_graph/abstract_store.rb
|
|
84
99
|
- lib/tfs_graph/associators/branch_associator.rb
|
|
85
|
-
- lib/tfs_graph/associators/
|
|
100
|
+
- lib/tfs_graph/associators/changeset_tree_builder.rb
|
|
101
|
+
- lib/tfs_graph/behaviors.rb
|
|
102
|
+
- lib/tfs_graph/behaviors/neo4j_repository/branch.rb
|
|
103
|
+
- lib/tfs_graph/behaviors/neo4j_repository/changeset.rb
|
|
104
|
+
- lib/tfs_graph/behaviors/neo4j_repository/project.rb
|
|
105
|
+
- lib/tfs_graph/behaviors/related_repository/branch.rb
|
|
106
|
+
- lib/tfs_graph/behaviors/related_repository/changeset.rb
|
|
107
|
+
- lib/tfs_graph/behaviors/related_repository/project.rb
|
|
86
108
|
- lib/tfs_graph/branch.rb
|
|
87
109
|
- lib/tfs_graph/branch/branch_archive_handler.rb
|
|
88
110
|
- lib/tfs_graph/branch/branch_normalizer.rb
|
|
@@ -95,10 +117,14 @@ files:
|
|
|
95
117
|
- lib/tfs_graph/changeset_merge/changeset_merge_store.rb
|
|
96
118
|
- lib/tfs_graph/config.rb
|
|
97
119
|
- lib/tfs_graph/entity.rb
|
|
120
|
+
- lib/tfs_graph/extensions.rb
|
|
98
121
|
- lib/tfs_graph/graph_populator.rb
|
|
99
122
|
- lib/tfs_graph/normalizer.rb
|
|
123
|
+
- lib/tfs_graph/persistable_entity.rb
|
|
100
124
|
- lib/tfs_graph/populators.rb
|
|
101
125
|
- lib/tfs_graph/populators/everything.rb
|
|
126
|
+
- lib/tfs_graph/populators/for_archived_branch.rb
|
|
127
|
+
- lib/tfs_graph/populators/for_branch.rb
|
|
102
128
|
- lib/tfs_graph/populators/for_project.rb
|
|
103
129
|
- lib/tfs_graph/populators/since_date.rb
|
|
104
130
|
- lib/tfs_graph/populators/since_last.rb
|
|
@@ -106,12 +132,25 @@ files:
|
|
|
106
132
|
- lib/tfs_graph/project.rb
|
|
107
133
|
- lib/tfs_graph/project/project_normalizer.rb
|
|
108
134
|
- lib/tfs_graph/project/project_store.rb
|
|
135
|
+
- lib/tfs_graph/repository.rb
|
|
136
|
+
- lib/tfs_graph/repository/neo4j_repository.rb
|
|
137
|
+
- lib/tfs_graph/repository/related_repository.rb
|
|
138
|
+
- lib/tfs_graph/repository_registry.rb
|
|
139
|
+
- lib/tfs_graph/server_registry.rb
|
|
109
140
|
- lib/tfs_graph/store_helpers.rb
|
|
110
141
|
- lib/tfs_graph/tfs_client.rb
|
|
111
142
|
- lib/tfs_graph/tfs_helpers.rb
|
|
112
143
|
- lib/tfs_graph/version.rb
|
|
113
|
-
-
|
|
144
|
+
- schema.cypher
|
|
145
|
+
- spec/branch_spec.rb
|
|
114
146
|
- spec/helpers_spec.rb
|
|
147
|
+
- spec/neo4j_repository_integration_spec.rb
|
|
148
|
+
- spec/persistable_entity_spec.rb
|
|
149
|
+
- spec/project_spec.rb
|
|
150
|
+
- spec/related_repository_integration_spec.rb
|
|
151
|
+
- spec/repository_registry_spec.rb
|
|
152
|
+
- spec/repository_spec.rb
|
|
153
|
+
- spec/server_registery_spec.rb
|
|
115
154
|
- spec/spec_helper.rb
|
|
116
155
|
- tfs_graph.gemspec
|
|
117
156
|
homepage: ''
|
|
@@ -124,21 +163,28 @@ require_paths:
|
|
|
124
163
|
- lib
|
|
125
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
165
|
requirements:
|
|
127
|
-
- -
|
|
166
|
+
- - ">="
|
|
128
167
|
- !ruby/object:Gem::Version
|
|
129
168
|
version: '0'
|
|
130
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
170
|
requirements:
|
|
132
|
-
- -
|
|
171
|
+
- - ">="
|
|
133
172
|
- !ruby/object:Gem::Version
|
|
134
173
|
version: '0'
|
|
135
174
|
requirements: []
|
|
136
175
|
rubyforge_project:
|
|
137
|
-
rubygems_version: 2.
|
|
176
|
+
rubygems_version: 2.2.1
|
|
138
177
|
signing_key:
|
|
139
178
|
specification_version: 4
|
|
140
|
-
summary: Simple graph db wrapper for TFS data
|
|
179
|
+
summary: Simple graph db wrapper for TFS data to various backends
|
|
141
180
|
test_files:
|
|
142
|
-
- spec/
|
|
181
|
+
- spec/branch_spec.rb
|
|
143
182
|
- spec/helpers_spec.rb
|
|
183
|
+
- spec/neo4j_repository_integration_spec.rb
|
|
184
|
+
- spec/persistable_entity_spec.rb
|
|
185
|
+
- spec/project_spec.rb
|
|
186
|
+
- spec/related_repository_integration_spec.rb
|
|
187
|
+
- spec/repository_registry_spec.rb
|
|
188
|
+
- spec/repository_spec.rb
|
|
189
|
+
- spec/server_registery_spec.rb
|
|
144
190
|
- spec/spec_helper.rb
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module TFSGraph
|
|
2
|
-
class ChangesetTreeCreator
|
|
3
|
-
class << self
|
|
4
|
-
def to_tree(branch)
|
|
5
|
-
changesets = branch.changesets
|
|
6
|
-
changesets.each.with_index do |changeset, i|
|
|
7
|
-
parent = (i == 0) ? branch : changesets[i-1]
|
|
8
|
-
|
|
9
|
-
if Changeset.find parent.id
|
|
10
|
-
changeset.parent = parent.id
|
|
11
|
-
changeset.save
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Related::Relationship.create :child, parent, changeset
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
data/spec/factories.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require 'tfs_graph/changeset'
|
|
2
|
-
|
|
3
|
-
FactoryGirl.define do
|
|
4
|
-
factory :changeset, class: TFSGraph::Changeset do
|
|
5
|
-
comment "Doing fun things"
|
|
6
|
-
committer "John Doe"
|
|
7
|
-
created { Time.now }
|
|
8
|
-
sequence :id
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
factory :branch do
|
|
12
|
-
original_path "$>DefaultCollection>Project"
|
|
13
|
-
path "$>DefaultCollection>Project"
|
|
14
|
-
project "BFG"
|
|
15
|
-
name "Project"
|
|
16
|
-
root "$>DefaultCollection>Project"
|
|
17
|
-
created { Time.now }
|
|
18
|
-
type "master"
|
|
19
|
-
end
|
|
20
|
-
end
|