gollum_rails 1.0.4 → 1.0.5
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/Gemfile +2 -1
- data/Gemfile.lock +118 -92
- data/Guardfile +7 -0
- data/HISTORY.md +32 -0
- data/README.md +7 -2
- data/Rakefile +5 -5
- data/gollum_rails.gemspec +9 -13
- data/lib/gollum_rails.rb +2 -9
- data/lib/gollum_rails/adapters/gollum.rb +12 -3
- data/lib/gollum_rails/adapters/gollum/page.rb +92 -45
- data/lib/gollum_rails/adapters/gollum/wiki.rb +12 -11
- data/lib/gollum_rails/page.rb +208 -65
- data/lib/gollum_rails/setup.rb +9 -2
- data/spec/gollum_rails/adapters/gollum/connector_spec.rb +8 -2
- data/spec/gollum_rails/adapters/gollum/page_spec.rb +18 -78
- data/spec/gollum_rails/adapters/gollum/{wiki_spec.rb → wiki_spec_off.rb} +0 -0
- data/spec/gollum_rails/page_spec.rb +310 -79
- data/spec/spec_helper.rb +0 -23
- metadata +17 -23
- data/lib/core_ext/string.rb +0 -3
- data/lib/gollum_rails/modulesDEPRECATED/hash.rb +0 -33
- data/lib/gollum_rails/modulesDEPRECATED/loader.rb +0 -5
- data/lib/grit/git-ruby/internal/pack.rb +0 -397
- data/spec/gollum_rails/modulesDEPRECATED/hash.rb +0 -31
- data/spec/gollum_rails_spec.rb +0 -9
- data/spec/spec.opts +0 -3
data/lib/gollum_rails/setup.rb
CHANGED
@@ -27,6 +27,9 @@ module GollumRails
|
|
27
27
|
# Gets / Sets the repository
|
28
28
|
attr_accessor :repository
|
29
29
|
|
30
|
+
# Gets / Sets the init options
|
31
|
+
attr_accessor :options
|
32
|
+
|
30
33
|
# Startup action for building wiki components
|
31
34
|
#
|
32
35
|
# Returns true or throws an exception if the path is invalid
|
@@ -39,7 +42,11 @@ module GollumRails
|
|
39
42
|
initialize_wiki @repository
|
40
43
|
end
|
41
44
|
end
|
42
|
-
|
45
|
+
end
|
46
|
+
|
47
|
+
# Wiki startup options
|
48
|
+
def options=(options)
|
49
|
+
@options = options
|
43
50
|
end
|
44
51
|
|
45
52
|
# defines block builder for Rails initializer.
|
@@ -68,7 +75,7 @@ module GollumRails
|
|
68
75
|
def initialize_wiki(path)
|
69
76
|
if path_valid? path
|
70
77
|
repository = Grit::Repo.new path.to_s
|
71
|
-
GollumRails::Adapters::Gollum::Wiki.new
|
78
|
+
GollumRails::Adapters::Gollum::Wiki.new(repository, options || {})
|
72
79
|
true
|
73
80
|
else
|
74
81
|
raise GollumInternalError, 'no repository path specified'
|
@@ -5,9 +5,15 @@ describe GollumRails::Adapters::Gollum::Connector do
|
|
5
5
|
@class = GollumRails::Adapters::Gollum::Connector
|
6
6
|
end
|
7
7
|
|
8
|
-
it "should test the Wiki
|
9
|
-
@class.
|
8
|
+
it "should test the Wiki path connector" do
|
9
|
+
@class.wiki_path.should be_a String
|
10
10
|
end
|
11
|
+
it "should test the Wiki options connector" do
|
12
|
+
@class.wiki_options.should be_a Hash
|
13
|
+
end
|
14
|
+
it "should test the Wiki options content" do
|
15
|
+
@class.wiki_options.should == {}
|
16
|
+
end
|
11
17
|
it "should test the Page class connector" do
|
12
18
|
@class.page_class.should == GollumRails::Adapters::Gollum::Page
|
13
19
|
end
|
@@ -6,84 +6,24 @@ describe GollumRails::Adapters::Gollum::Page do
|
|
6
6
|
:name => 'The Mosny',
|
7
7
|
:email => 'mosny@zyg.li'
|
8
8
|
}
|
9
|
-
|
10
|
-
@location = "#{File.dirname(__FILE__)}/../../../utils/wiki.git"
|
11
|
-
@repo = Grit::Repo.init_bare @location
|
12
|
-
@wiki = GollumRails::Adapters::Gollum::Wiki.new @repo
|
13
|
-
@page = GollumRails::Adapters::Gollum::Page.new
|
14
9
|
end
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
@page.delete_page(@commit,page).should be_instance_of String
|
34
|
-
|
35
|
-
@page.new_page 'testpage', 'content', :markdown, @commit
|
36
|
-
@page.delete_page(@commit).should be_instance_of String
|
37
|
-
end
|
38
|
-
it "should update an existing page" do
|
39
|
-
@page.new_page 'testpage', 'content', :markdown, @commit
|
40
|
-
page = {}
|
41
|
-
page[:name] = 'test'
|
42
|
-
page[:format] = :markdown
|
43
|
-
page[:content] = "content"
|
44
|
-
@page.update_page(page, @commit)
|
45
|
-
|
46
|
-
page = []
|
47
|
-
expect{@page.update_page(page, @commit)}.to raise_error GollumRails::Adapters::Gollum::Error
|
48
|
-
|
49
|
-
page = {}
|
50
|
-
page[:content] = "test"
|
51
|
-
@page.update_page(page, @commit).raw_data.should == page[:content]
|
52
|
-
|
53
|
-
page = {}
|
54
|
-
page[:name] = "test"
|
55
|
-
@page.update_page(page, @commit).name.should == page[:name]
|
56
|
-
|
57
|
-
page = {}
|
58
|
-
page[:format] = :wiki
|
59
|
-
@page.update_page(page, @commit).format.should == :mediawiki
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
@page.delete_page(@commit)
|
64
|
-
end
|
65
|
-
it "should find a page" do
|
66
|
-
@page.new_page 'content_page', 'content', :markdown, @commit
|
67
|
-
|
68
|
-
@page.find_page("content_page")
|
69
|
-
@page.delete_page(@commit)
|
70
|
-
end
|
71
|
-
it "should test the commit methods" do
|
72
|
-
@page.new_page 'content_page', 'content', :markdown, @commit
|
73
|
-
@page.page_last_edited_date.should be_instance_of Time
|
74
|
-
@page.page_created.should be_instance_of Time
|
75
|
-
@page.page_last_commit.should be_instance_of Grit::Commit
|
76
|
-
@page.page_commit(@page.page.versions.first.id).should be_instance_of Grit::Commit
|
77
|
-
@page.page_commit_date(@page.page.versions.first.id).should be_instance_of Time
|
78
|
-
@page.page_first_commit.should be_instance_of Grit::Commit
|
79
|
-
@page.delete_page(@commit)
|
80
|
-
end
|
81
|
-
it "should test the error throwing" do
|
82
|
-
expect{@page.page_last_commit}.to raise_error GollumRails::Adapters::Gollum::Error
|
83
|
-
expect{@page.page_first_commit}.to raise_error GollumRails::Adapters::Gollum::Error
|
84
|
-
expect{@page.page_last_edited_date}.to raise_error GollumRails::Adapters::Gollum::Error
|
85
|
-
expect{@page.page_created}.to raise_error GollumRails::Adapters::Gollum::Error
|
86
|
-
expect{@page.page_commit(1)}.to raise_error GollumRails::Adapters::Gollum::Error
|
87
|
-
expect{@page.page_commit_date(1)}.to raise_error GollumRails::Adapters::Gollum::Error
|
10
|
+
describe "Connector stuff" do
|
11
|
+
it "should have updated the page_class on initialize" do
|
12
|
+
adapter = GollumRails::Adapters::Gollum::Page.new
|
13
|
+
GollumRails::Adapters::Gollum::Connector.page_class.should == GollumRails::Adapters::Gollum::Page
|
14
|
+
end
|
15
|
+
end
|
16
|
+
describe "statically methods" do
|
17
|
+
it "is a hash" do
|
18
|
+
GollumRails::Adapters::Gollum::Page.parse_path('google/de').should be_a Hash
|
19
|
+
end
|
20
|
+
it "should equal" do
|
21
|
+
path1 = GollumRails::Adapters::Gollum::Page.parse_path('google/de')
|
22
|
+
path2 = GollumRails::Adapters::Gollum::Page.parse_path('/google/de')
|
23
|
+
path1.should == path2
|
24
|
+
end
|
25
|
+
it "adds a leading slash" do
|
26
|
+
GollumRails::Adapters::Gollum::Page.parse_path('google/de')[:path][0].should == '/'
|
27
|
+
end
|
88
28
|
end
|
89
29
|
end
|
File without changes
|
@@ -2,79 +2,173 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Gollum Page" do
|
4
4
|
before(:each) do
|
5
|
+
GollumRails::Setup.build do |config|
|
6
|
+
config.repository = File.join(File.dirname(__FILE__),'..','utils','wiki.git')
|
7
|
+
config.options={}
|
8
|
+
config.startup = true
|
9
|
+
end
|
10
|
+
|
5
11
|
@commit = {
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
12
|
+
name: "flo",
|
13
|
+
message: "commit",
|
14
|
+
email: "mosny@zyg.li"
|
9
15
|
}
|
10
16
|
@call = {
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
17
|
+
name: "Goole",
|
18
|
+
content: "content data",
|
19
|
+
commit: @commit,
|
20
|
+
format: :markdown
|
15
21
|
}
|
16
22
|
end
|
23
|
+
|
17
24
|
describe GollumRails::Page do
|
18
|
-
class RailsModel < GollumRails::Page
|
25
|
+
class RailsModel < GollumRails::Page; end
|
19
26
|
|
27
|
+
describe "the creation of a page" do
|
28
|
+
|
29
|
+
before :each do
|
30
|
+
@rr = RailsModel.new(@call)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "saves via .save" do
|
34
|
+
@rr.save.should be_a GollumRails::Page
|
35
|
+
end
|
36
|
+
|
20
37
|
|
21
|
-
|
38
|
+
it "saves via .create" do
|
39
|
+
RailsModel.create(@call).should be_a GollumRails::Page
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
it "fails if invalid arguments are supplied via the ! create" do
|
44
|
+
args = {
|
45
|
+
name: "Gaming",
|
46
|
+
content: "content data",
|
47
|
+
commit: {},
|
48
|
+
format: :markdown
|
49
|
+
}
|
50
|
+
expect{RailsModel.create!(args)}.to raise_error StandardError #change this
|
51
|
+
end
|
52
|
+
it "has a history now" do
|
53
|
+
@rr.save
|
54
|
+
@rr.history.should be_a Array
|
55
|
+
end
|
56
|
+
it "outputs the raw_data" do
|
57
|
+
@rr.save
|
58
|
+
@rr.raw_data.should == @call[:content]
|
59
|
+
end
|
60
|
+
it "has the formatted data" do
|
61
|
+
@rr.save
|
62
|
+
@rr.html_data.should == 'content data'
|
63
|
+
end
|
64
|
+
it "was last changed by me" do
|
65
|
+
@rr.save
|
66
|
+
@rr.last_changed_by.should == 'flo <mosny@zyg.li>'
|
67
|
+
end
|
68
|
+
it "has a title" do
|
69
|
+
@rr.save
|
70
|
+
@rr.title.should == "Goole"
|
71
|
+
end
|
72
|
+
it "has a url" do
|
73
|
+
@rr.save
|
74
|
+
@rr.url.should =="Goole"
|
75
|
+
end
|
22
76
|
|
23
|
-
it "should test the creation of a page" do
|
24
|
-
rr = RailsModel.new(@call)
|
25
|
-
rr.save.should be_instance_of Gollum::Page
|
26
|
-
rr.save!.should be_instance_of Gollum::Page
|
27
|
-
RailsModel.create(@call)
|
28
77
|
end
|
29
78
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
79
|
+
describe "the update of a page" do
|
80
|
+
before :each do
|
81
|
+
@rr = RailsModel.new(@call)
|
82
|
+
@rr.save
|
83
|
+
end
|
84
|
+
|
85
|
+
it { @rr.update_attributes({:name => "google", :format => :wiki}).should be_a Gollum::Page }
|
86
|
+
|
34
87
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
88
|
+
describe "method missings" do
|
89
|
+
|
90
|
+
it "should perform a normal find" do
|
91
|
+
RailsModel.find_by_name('Goole').should be_a GollumRails::Page
|
92
|
+
|
93
|
+
|
94
|
+
end
|
95
|
+
|
40
96
|
end
|
41
97
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
98
|
+
describe "should test the deletion of a page" do
|
99
|
+
before :each do
|
100
|
+
@rr = RailsModel.new @call
|
101
|
+
@cc = @rr.save
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should return a string" do
|
105
|
+
delete = @rr.delete
|
106
|
+
delete.should be_a String
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should return a SHA1 hash" do
|
110
|
+
delete = @rr.delete
|
111
|
+
delete.length.should == 40
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should also work was result from save" do
|
115
|
+
delete = @cc.delete
|
116
|
+
delete.should be_a String
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should test the recreation" do
|
120
|
+
delete = @rr.delete
|
121
|
+
@rr.save.should be_a GollumRails::Page
|
122
|
+
@rr.delete.should be_a String
|
123
|
+
|
52
124
|
end
|
53
125
|
end
|
54
126
|
|
127
|
+
|
55
128
|
it "should test exception methods" do
|
56
|
-
|
129
|
+
RailsModel.create @call
|
130
|
+
expect{RailsModel.create! @call}.to raise_error Gollum::DuplicatePageError
|
57
131
|
end
|
58
132
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
133
|
+
describe "supported formats" do
|
134
|
+
['markdown', 'rdoc', 'org', 'pod'].each do |format|
|
135
|
+
it "should support #{format}" do
|
136
|
+
RailsModel.format_supported?(format).should be_true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
66
140
|
end
|
67
|
-
|
68
|
-
|
69
|
-
rr
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
141
|
+
|
142
|
+
describe "accessors" do
|
143
|
+
let(:rr){RailsModel.new @call}
|
144
|
+
|
145
|
+
it "should have a name" do
|
146
|
+
expect(rr.name).to match(/^Goole$/)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should have a content" do
|
150
|
+
expect(rr.content).to match(/^content\ data$/)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should have a commit which is a Hash" do
|
154
|
+
expect(rr.commit).to be_a Hash
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should be @commit" do
|
158
|
+
expect(rr.commit).to be(@commit)
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should have a format" do
|
162
|
+
expect(rr.format.to_s).to match('markdown')
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should be a Gollum::Page after save" do
|
166
|
+
rr.save
|
167
|
+
expect(rr.gollum_page).to be_a Gollum::Page
|
168
|
+
end
|
169
|
+
|
77
170
|
end
|
171
|
+
|
78
172
|
it "should test setters" do
|
79
173
|
rr = RailsModel.new
|
80
174
|
rr.name=("google").should == "google"
|
@@ -82,12 +176,34 @@ describe "Gollum Page" do
|
|
82
176
|
rr.content=("content").should == "content"
|
83
177
|
rr.format=(:markdown).should == :markdown
|
84
178
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
179
|
+
|
180
|
+
it "tests the find method to return nil if no page was found" do
|
181
|
+
expect(RailsModel.find('whoooohoo')).to be_nil
|
182
|
+
end
|
183
|
+
|
184
|
+
it "tests the find method to return a gollum_rails:page if a page was found" do
|
185
|
+
expect(RailsModel.find('Goole')).to be_a GollumRails::Page
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should not be persisted on initialization or finding' do
|
189
|
+
init = RailsModel.find_or_initialize_by_name('totallybad', @commit)
|
190
|
+
expect(init.persisted?).to be_false
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should find the page without a commit if it exists" do
|
194
|
+
expect(RailsModel.find_or_initialize_by_name("Goole").persisted?).to be_true
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should find the page with a commit if it exists" do
|
198
|
+
expect(RailsModel.find_or_initialize_by_name("Goole", @commit).persisted?).to be_true
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should be valid on initialization or finding" do
|
202
|
+
init = RailsModel.find_or_initialize_by_name('whoooohooo', @commit)
|
203
|
+
expect(init.valid?).to be_true
|
204
|
+
|
205
|
+
#RailsModel.find_or_initialize_by_name(@call[:name], @commit).should be_a GollumRails::Page
|
206
|
+
|
91
207
|
end
|
92
208
|
end
|
93
209
|
describe "callbacks" do
|
@@ -136,16 +252,15 @@ describe "Gollum Page" do
|
|
136
252
|
test = CallbackTest.new @call
|
137
253
|
test.persisted?.should be_false
|
138
254
|
test.save
|
139
|
-
test.delete @commit
|
140
|
-
test.save
|
141
|
-
test.update_attributes @call
|
142
|
-
test.persisted?.should be_true
|
143
255
|
end
|
144
256
|
end
|
145
257
|
describe "rails extension" do
|
258
|
+
|
146
259
|
it "should test fetch_all" do
|
147
|
-
GollumRails::Page.all.length.should ==
|
148
|
-
|
260
|
+
GollumRails::Page.all.length.should == 1
|
261
|
+
end
|
262
|
+
it "should test all" do
|
263
|
+
GollumRails::Page.find_all.length.should == 1
|
149
264
|
end
|
150
265
|
|
151
266
|
end
|
@@ -157,29 +272,35 @@ describe "Gollum Page" do
|
|
157
272
|
class Callbackt < GollumRails::Page
|
158
273
|
validates_presence_of :name
|
159
274
|
end
|
275
|
+
|
160
276
|
cla = Callbackt.new @call
|
161
277
|
cla.valid?.should be_true
|
162
278
|
end
|
279
|
+
|
163
280
|
class SugarBaby < GollumRails::Page
|
164
281
|
validates_presence_of :name
|
165
282
|
validates_length_of :name, :minimum => 20
|
166
283
|
validates_length_of :format, :maximum => 14
|
167
284
|
end
|
285
|
+
|
168
286
|
it "should test string validation" do
|
169
287
|
@call[:name] = "das ist zu lang"*10
|
170
288
|
cla = SugarBaby.new @call
|
171
289
|
cla.valid?.should be_true
|
172
290
|
end
|
291
|
+
|
173
292
|
it "should test the presence validator" do
|
174
293
|
@call[:name] = [ ]
|
175
294
|
bla = SugarBaby.new @call
|
176
295
|
bla.valid?.should be_false
|
177
296
|
end
|
297
|
+
|
178
298
|
it "should test the length validator for name" do
|
179
299
|
@call[:name] = "das"
|
180
300
|
res = SugarBaby.new @call
|
181
301
|
res.valid?.should be_false
|
182
302
|
end
|
303
|
+
|
183
304
|
it "should test the length validator for format" do
|
184
305
|
@call[:format] = :toolongformatstringforvalidator
|
185
306
|
res = SugarBaby.new @call
|
@@ -187,21 +308,131 @@ describe "Gollum Page" do
|
|
187
308
|
end
|
188
309
|
|
189
310
|
end
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
311
|
+
|
312
|
+
describe "diffing commits" do
|
313
|
+
class CommitDiff < GollumRails::Page
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should display the diff commit" do
|
317
|
+
commit = {
|
318
|
+
name: "flo",
|
319
|
+
message: "commit",
|
320
|
+
email: "mosny@zyg.li"
|
321
|
+
}
|
322
|
+
call = {
|
323
|
+
name: "a Page",
|
324
|
+
content: "my content",
|
325
|
+
commit: commit,
|
326
|
+
format: :markdown
|
327
|
+
}
|
328
|
+
|
329
|
+
res = CommitDiff.new call
|
330
|
+
res.save
|
331
|
+
res.update_attributes("content",nil,:markdown, @commit)
|
332
|
+
diff = res.compare_commits(res.history.first)
|
333
|
+
expect(diff).to be_a String
|
334
|
+
expect(diff).to match(/---/)
|
335
|
+
res.delete
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
describe "Filename" do
|
341
|
+
class Fns < GollumRails::Page
|
342
|
+
end
|
343
|
+
it "should assemble a filename" do
|
344
|
+
res = CommitDiff.new @call
|
345
|
+
expect(res.filename).to match(/^Goole\.md$/)
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
describe "Sub Page" do
|
350
|
+
class Fns < GollumRails::Page
|
351
|
+
end
|
352
|
+
|
353
|
+
it "should return nil if not persisted" do
|
354
|
+
res = CommitDiff.new @call
|
355
|
+
expect(res.sub_page?).to be_nil
|
356
|
+
end
|
357
|
+
it "should be true" do
|
358
|
+
res = CommitDiff.new @call.merge(name: '_aPage')
|
359
|
+
res.save
|
360
|
+
expect(res.sub_page?).to be_true
|
361
|
+
res.delete
|
362
|
+
end
|
363
|
+
|
364
|
+
it "should be false" do
|
365
|
+
res = CommitDiff.new @call
|
366
|
+
res.save
|
367
|
+
expect(res.sub_page?).to be_false
|
368
|
+
res.delete
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
describe "Current version" do
|
373
|
+
class Fns < GollumRails::Page
|
374
|
+
end
|
375
|
+
|
376
|
+
it "current version should have 7 digest" do
|
377
|
+
res = CommitDiff.new @call
|
378
|
+
res.save
|
379
|
+
expect(res.current_version.length).to be(7)
|
380
|
+
res.delete
|
381
|
+
end
|
382
|
+
|
383
|
+
it "should be nil if page has not been set" do
|
384
|
+
res = CommitDiff.new @call
|
385
|
+
expect(res.current_version).to be_nil
|
386
|
+
end
|
205
387
|
|
206
|
-
|
388
|
+
it "should be the latest version of the page but shortened" do
|
389
|
+
res = CommitDiff.new @call
|
390
|
+
res.save
|
391
|
+
expect(res.gollum_page.version.to_s).to match(res.current_version)
|
392
|
+
res.delete
|
393
|
+
end
|
394
|
+
it "should display the long version" do
|
395
|
+
res = CommitDiff.new @call
|
396
|
+
res.save
|
397
|
+
expect(res.gollum_page.version.to_s).to match(/^#{res.current_version(true)}$/)
|
398
|
+
res.delete
|
399
|
+
end
|
400
|
+
|
401
|
+
end
|
402
|
+
|
403
|
+
describe 'History' do
|
404
|
+
class Fns < GollumRails::Page
|
405
|
+
end
|
406
|
+
|
407
|
+
it "history should return nil if no gollum_page was saved" do
|
408
|
+
res = Fns.new @call
|
409
|
+
expect(res.history).to be_nil
|
410
|
+
end
|
411
|
+
|
412
|
+
it "history should return the pages versions if there are changes" do
|
413
|
+
res = Fns.new @call
|
414
|
+
res.save
|
415
|
+
expect(res.history).to be_a Array
|
416
|
+
res.delete
|
417
|
+
end
|
418
|
+
|
419
|
+
end
|
420
|
+
|
421
|
+
# describe "the thread safety" do
|
422
|
+
# class ThreadModel < GollumRails::Page
|
423
|
+
#
|
424
|
+
# end
|
425
|
+
# it "should save " do
|
426
|
+
# 100.times do |time|
|
427
|
+
# Thread.new do
|
428
|
+
# ThreadModel.new(@call)
|
429
|
+
# ThreadModel.save.should be_a(GollumRails::Page)
|
430
|
+
# ThreadModel.delete(@commit).length.should == 40
|
431
|
+
# end
|
432
|
+
# end
|
433
|
+
#
|
434
|
+
# end
|
435
|
+
|
436
|
+
|
437
|
+
#end
|
207
438
|
end
|