gollum_rails 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac973e7abd2f4b27cdc5568448bc2b604a8a43bc
4
- data.tar.gz: b8dbaa9689b6ac1ada39efc362dea305a3fe00ef
3
+ metadata.gz: f5e3515f14116b1aeb5ed2717b76293cbd1548e7
4
+ data.tar.gz: 6de8ad0cee8e27e0d800f2ac323ed1182ae85b7f
5
5
  SHA512:
6
- metadata.gz: 02ce3f25360dd389980da220ec91ce2f8a08abccb56799933e705523da96beccf5031ead746a3f24495d713db7b64bb46287f3919e8963e1ac118da3fe75ff7e
7
- data.tar.gz: d4a7a8b643cfbf61a6c57e3f48eadac25d6434978ba972a2e288cbeac6824198cc349bd272d38b05f6e7ec3ce71147c49ad5369beb1d27dde8e91413a7a83fbf
6
+ metadata.gz: c27bc643db23fdcd0c22847dfc202b32f9215e54fa48e67e48500a9a0b8733b41352bca8d27b064d9501f40aa62e64ff25b53596bee6946cdcf2a6d0a1bae7ff
7
+ data.tar.gz: a15689feba2f801ea6f6de6eacd37ebb71833d00c9c075dc19eaa9be66572fb93883af8486cb668edf76b57acaa36f2dd97e5503e6919fef8f12dc96ce0f0e9d
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'coveralls', require: false
4
-
4
+ gem 'guard'
5
+ gem 'guard-rspec'
5
6
 
6
7
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gollum_rails (1.4.2)
4
+ gollum_rails (1.4.3)
5
5
  activemodel (>= 4.0.0)
6
6
  gollum-lib (~> 1.0.4)
7
7
 
@@ -35,6 +35,7 @@ GEM
35
35
  arel (4.0.0)
36
36
  atomic (1.1.9)
37
37
  builder (3.1.4)
38
+ coderay (1.0.9)
38
39
  colorize (0.5.8)
39
40
  coveralls (0.6.4)
40
41
  colorize
@@ -44,6 +45,8 @@ GEM
44
45
  thor
45
46
  diff-lcs (1.2.4)
46
47
  erubis (2.7.0)
48
+ ffi (1.9.0)
49
+ formatador (0.2.4)
47
50
  github-markdown (0.5.3)
48
51
  github-markup (0.7.5)
49
52
  gollum-lib (1.0.4)
@@ -58,11 +61,26 @@ GEM
58
61
  diff-lcs (~> 1.1)
59
62
  mime-types (~> 1.15)
60
63
  posix-spawn (~> 0.3.6)
64
+ guard (1.8.0)
65
+ formatador (>= 0.2.4)
66
+ listen (>= 1.0.0)
67
+ lumberjack (>= 1.0.2)
68
+ pry (>= 0.9.10)
69
+ thor (>= 0.14.6)
70
+ guard-rspec (3.0.1)
71
+ guard (>= 1.8)
72
+ rspec (~> 2.13)
61
73
  hike (1.2.3)
62
74
  i18n (0.6.4)
75
+ listen (1.1.6)
76
+ rb-fsevent (>= 0.9.3)
77
+ rb-inotify (>= 0.9)
78
+ rb-kqueue (>= 0.2)
79
+ lumberjack (1.0.3)
63
80
  mail (2.5.4)
64
81
  mime-types (~> 1.16)
65
82
  treetop (~> 1.4.8)
83
+ method_source (0.8.1)
66
84
  mime-types (1.23)
67
85
  mini_portile (0.5.1)
68
86
  minitest (4.7.5)
@@ -71,6 +89,10 @@ GEM
71
89
  mini_portile (~> 0.5.0)
72
90
  polyglot (0.3.3)
73
91
  posix-spawn (0.3.6)
92
+ pry (0.9.12.2)
93
+ coderay (~> 1.0.5)
94
+ method_source (~> 0.8)
95
+ slop (~> 3.4)
74
96
  pygments.rb (0.5.2)
75
97
  posix-spawn (~> 0.3.6)
76
98
  yajl-ruby (~> 1.1.0)
@@ -91,6 +113,11 @@ GEM
91
113
  rake (>= 0.8.7)
92
114
  thor (>= 0.18.1, < 2.0)
93
115
  rake (10.1.0)
116
+ rb-fsevent (0.9.3)
117
+ rb-inotify (0.9.0)
118
+ ffi (>= 0.5.0)
119
+ rb-kqueue (0.2.0)
120
+ ffi (>= 0.5.0)
94
121
  rest-client (1.6.7)
95
122
  mime-types (>= 1.16)
96
123
  rr (1.1.1)
@@ -108,6 +135,7 @@ GEM
108
135
  multi_json (~> 1.0)
109
136
  simplecov-html (~> 0.7.1)
110
137
  simplecov-html (0.7.1)
138
+ slop (3.4.5)
111
139
  sprockets (2.10.0)
112
140
  hike (~> 1.2)
113
141
  multi_json (~> 1.0)
@@ -134,6 +162,8 @@ PLATFORMS
134
162
  DEPENDENCIES
135
163
  coveralls
136
164
  gollum_rails!
165
+ guard
166
+ guard-rspec
137
167
  rails (>= 4.0.0)
138
168
  rr (~> 1.1.1)
139
169
  rspec (~> 2.13.0)
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ guard :rspec do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+
6
+ end
7
+
data/HISTORY.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 1.4.3 1th September 2013
2
+ * Display the current pages version (short OR long)
3
+ * Display if the page is a sub page
4
+ * Display the pages filename
5
+ * Improved specs
6
+ * Refactored find method to return nil if no page was found (BUG)
7
+ * Refactored find_or_initialize_by_name to be useable :)
8
+ * Returning nil on history if a page was not saved
9
+ * Added finding with version string
10
+ * Using activemodel convenient `destroy` and deprecated old `delete`
11
+ * Added callback for initializer
12
+
1
13
  # 1.4.2 1th August 2013
2
14
  * Found an issue that the Wiki was not updating from external pushes
3
15
  * Some helper methods implemented
data/README.md CHANGED
@@ -28,6 +28,7 @@ with gollum_rails you can:
28
28
  ## [Usage](https://github.com/nirnanaaa/gollum_rails/wiki/Usage)
29
29
 
30
30
 
31
+
31
32
  ## DEVELOPER
32
33
 
33
34
  Very cool. Just fork this repository and send me pull requests.
data/gollum_rails.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.name = 'gollum_rails'
5
5
  s.rubyforge_project = s.name
6
6
 
7
- s.version = '1.4.2'
7
+ s.version = '1.4.3'
8
8
 
9
9
  s.summary = 'Combines Gollum and Rails'
10
10
  s.description= 'include Gollum into Rails with ease'
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.files = %w[
29
29
  Gemfile
30
30
  Gemfile.lock
31
+ Guardfile
31
32
  HISTORY.md
32
33
  LICENSE
33
34
  README.md
@@ -65,7 +66,6 @@ Gem::Specification.new do |s|
65
66
  spec/gollum_rails/respository_spec.rb
66
67
  spec/gollum_rails/setup_spec.rb
67
68
  spec/gollum_rails/wiki_spec.rb
68
- spec/spec.opts
69
69
  spec/spec_helper.rb
70
70
  ]
71
71
  # = MANIFEST =
data/lib/gollum_rails.rb CHANGED
@@ -23,7 +23,7 @@ module GollumRails
23
23
  autoload :Setup, 'gollum_rails/setup'
24
24
 
25
25
  # GollumRails version string
26
- VERSION = '1.4.2'
26
+ VERSION = '1.4.3'
27
27
 
28
28
  # Simplified error
29
29
  class Error < StandardError; end
@@ -41,11 +41,13 @@ module GollumRails
41
41
  #
42
42
  # name - the pagename to search
43
43
  # wiki - instance of Gollum::Wiki
44
+ # version - optional - The pages version
44
45
  #
45
46
  # Returns the Gollum::Page class
46
- def find_page(name, wiki)
47
+ def find_page(name, wiki, version=nil)
48
+ wiki.clear_cache
47
49
  path_data = parse_path(name)
48
- wiki.paged(path_data[:name], path_data[:path], exact = true)
50
+ wiki.paged(path_data[:name], path_data[:path], exact = true, version)
49
51
  end
50
52
  end
51
53
 
@@ -61,6 +63,7 @@ module GollumRails
61
63
  def new_page( name, content, wiki, type=:markdown, commit={} )
62
64
  path_data = self.class.parse_path(name)
63
65
  wiki.write_page( path_data[:name], type, content, commit, path_data[:path].gsub!(/^\//, "").gsub!(/(\/)+$/,'') || "" )
66
+ wiki.clear_cache
64
67
  self.class.find_page( name, wiki )
65
68
  end
66
69
 
@@ -75,11 +78,14 @@ module GollumRails
75
78
  #
76
79
  # Returns the page
77
80
  def update_page( page, wiki, content=nil, commit={}, name=nil, format=nil)
78
- return if !page || ((!content||page.raw_data == content) && page.format == format)
81
+ wiki.clear_cache
82
+ return page if page.nil?
79
83
  name ||= page.name
80
84
  format = (format || page.format).to_sym
81
85
  content ||= page.raw_data
82
- wiki.update_page(page,name,format,content.to_s,commit)
86
+
87
+ wiki.update_page(page,name,format,content.to_s,commit) unless ((!content||page.raw_data == content) && page.format == format)
88
+
83
89
  self.class.find_page( mixin(page.url_path, name), wiki )
84
90
  end
85
91
 
@@ -103,6 +109,7 @@ module GollumRails
103
109
  #
104
110
  # Returns the commit id
105
111
  def delete_page( page,wiki,commit={} )
112
+ wiki.clear_cache
106
113
  wiki.delete_page(page, commit)
107
114
  end
108
115
 
@@ -123,6 +130,7 @@ module GollumRails
123
130
  #
124
131
  # Returns the Gollum::Page class
125
132
  def find_page(name)
133
+
126
134
  self.class.find_page(name)
127
135
  end
128
136
 
@@ -45,9 +45,13 @@ module GollumRails
45
45
  # commit - Hash
46
46
  #
47
47
  # Returns self
48
- def find_or_initialize_by_name(name, commit)
48
+ def find_or_initialize_by_name(name, commit={})
49
49
  result_for_find = find(name)
50
- create({:format => :markdown, :name => name, :content => ".", :commit => commit })
50
+ unless result_for_find.nil?
51
+ result_for_find
52
+ else
53
+ new(:format => :markdown, :name => name, :content => ".", :commit => commit)
54
+ end
51
55
  end
52
56
 
53
57
  # Checks if the fileformat is supported
@@ -56,8 +60,7 @@ module GollumRails
56
60
  #
57
61
  # Returns true or false
58
62
  def format_supported?(format)
59
- supported = ['ascii', 'github-markdown','markdown', 'creole', 'org', 'pod', 'rdoc']
60
- format.in?(supported)
63
+ Gollum::Markup.formats.include?(format.to_sym)
61
64
  end
62
65
 
63
66
  # first creates an instance of itself and executes the save function.
@@ -87,10 +90,15 @@ module GollumRails
87
90
  # Finds a page based on the name and specified version
88
91
  #
89
92
  # name - the name of the page
93
+ # version - optional - The pages version
90
94
  #
91
95
  # Return an instance of Gollum::Page
92
- def find(name)
93
- self.new(gollum_page: Adapters::Gollum::Page.find_page(name, wiki))
96
+ def find(name, version=nil)
97
+ page = Adapters::Gollum::Page.find_page(name, wiki, version)
98
+
99
+ return new( :gollum_page => page ) unless page.nil?
100
+ return nil
101
+
94
102
  end
95
103
 
96
104
  # Gets all pages in the wiki
@@ -127,11 +135,13 @@ module GollumRails
127
135
  #
128
136
  # commit must be given to perform any page action!
129
137
  def initialize(attrs = {})
130
- if Adapters::Gollum::Connector.enabled
131
- attrs.each{|k,v| self.public_send("#{k}=",v)} if attrs
132
- update_attrs if attrs[:gollum_page]
133
- else
134
- raise GollumInternalError, 'gollum_rails is not enabled!'
138
+ run_callbacks :initialize do
139
+ if Adapters::Gollum::Connector.enabled
140
+ attrs.each{|k,v| self.public_send("#{k}=",v)} if attrs
141
+ update_attrs if attrs[:gollum_page]
142
+ else
143
+ raise GollumInternalError, 'gollum_rails is not enabled!'
144
+ end
135
145
  end
136
146
  end
137
147
 
@@ -141,10 +151,10 @@ module GollumRails
141
151
 
142
152
 
143
153
  # Gets / Sets the pages name
144
- attr_accessor :name
154
+ attr_writer :name
145
155
 
146
156
  # Gets / Sets the contents content
147
- attr_accessor :content
157
+ attr_writer :content
148
158
 
149
159
  # Gets / Sets the commit Hash
150
160
  attr_accessor :commit
@@ -160,9 +170,16 @@ module GollumRails
160
170
 
161
171
  # Gets the pages format
162
172
  def format
163
- @format.to_sym
173
+ (@format || @gollum_page.format).to_sym
164
174
  end
165
175
 
176
+ def name
177
+ @name ||= @gollum_page.name
178
+ end
179
+
180
+ def content
181
+ @content ||= @gollum_page.content
182
+ end
166
183
 
167
184
  # Gets the page class
168
185
  def page
@@ -236,19 +253,29 @@ module GollumRails
236
253
  @gollum_page = page.update_page(gollum_page, wiki, content, get_right_commit(commit), name, format)
237
254
  end
238
255
  end
239
-
256
+
240
257
  # == Deletes current page (also available static. See below)
241
258
  #
242
259
  # commit - optional. If given this commit will be used instead of that one, used
243
260
  # to initialize the instance
244
261
  #
245
262
  # Returns the commit id of the current action as String
246
- def delete(commit=nil)
263
+ def destroy(commit=nil)
247
264
  run_callbacks :delete do
248
265
  page.delete_page(gollum_page, wiki, get_right_commit(commit))
249
266
  end
250
267
  end
251
268
 
269
+ # == Deletes current page (also available static. See below)
270
+ #
271
+ # commit - optional. If given this commit will be used instead of that one, used
272
+ # to initialize the instance
273
+ #
274
+ # Returns the commit id of the current action as String
275
+ def delete(commit=nil)
276
+ destroy(commit)
277
+ end
278
+
252
279
  # checks if entry already has been saved
253
280
  #
254
281
  #
@@ -305,6 +332,7 @@ module GollumRails
305
332
  #
306
333
  # Returns an Array
307
334
  def history
335
+ return nil unless persisted?
308
336
  gollum_page.versions
309
337
  end
310
338
 
@@ -315,11 +343,38 @@ module GollumRails
315
343
  "%s <%s>" % [history.last.author.name, history.last.author.email]
316
344
  end
317
345
 
346
+ # == Compare 2 Commits.
347
+ #
348
+ # sha1 - SHA1
349
+ # sha2 - SHA1
350
+ def compare_commits(sha1,sha2=nil)
351
+ Page.wiki.full_reverse_diff_for(@gollum_page,sha1,sha2)
352
+ end
318
353
 
319
- def compare_commits(sha1,sha2)
320
- puts "NOT YET IMPLEMENTED"
354
+ # == The pages filename, based on the name and the format
355
+ #
356
+ # Returns a String
357
+ def filename
358
+ Page.wiki.page_file_name(@name, @format)
321
359
  end
322
360
 
361
+ # == Checks if current page is a subpage
362
+ def sub_page?
363
+ return nil unless persisted?
364
+ @gollum_page.sub_page
365
+ end
366
+
367
+ # == Gets the version of current commit
368
+ #
369
+ def current_version(long=false)
370
+ return nil unless persisted?
371
+ unless long
372
+ @gollum_page.version_short
373
+ else
374
+ @gollum_page.version.to_s
375
+ end
376
+
377
+ end
323
378
 
324
379
  #######
325
380
  private
@@ -137,25 +137,45 @@ describe "Gollum Page" do
137
137
  expect{RailsModel.create! @call}.to raise_error Gollum::DuplicatePageError
138
138
  end
139
139
 
140
- it "should test the supported formats" do
141
- RailsModel.format_supported?('ascii').should be_true
142
- RailsModel.format_supported?('markdown').should be_true
143
- RailsModel.format_supported?('github-markdown').should be_true
144
- RailsModel.format_supported?('rdoc').should be_true
145
- RailsModel.format_supported?('org').should be_true
146
- RailsModel.format_supported?('pod').should be_true
140
+ describe "supported formats" do
141
+ ['markdown', 'rdoc', 'org', 'pod'].each do |format|
142
+ it "should support #{format}" do
143
+ RailsModel.format_supported?(format).should be_true
144
+ end
145
+ end
146
+
147
147
  end
148
-
149
- it "should test getters" do
150
- rr = RailsModel.new @call
151
- rr.name.should == "Goole"
152
- rr.content.should == "content data"
153
- rr.commit.should be_a Hash
154
- rr.commit.should == @commit
155
- rr.format.should == :markdown
156
- rr.save
157
- rr.page.should be_a GollumRails::Adapters::Gollum::Page
148
+
149
+ describe "accessors" do
150
+ let(:rr){RailsModel.new @call}
151
+
152
+ it "should have a name" do
153
+ expect(rr.name).to match(/^Goole$/)
154
+ end
155
+
156
+ it "should have a content" do
157
+ expect(rr.content).to match(/^content\ data$/)
158
+ end
159
+
160
+ it "should have a commit which is a Hash" do
161
+ expect(rr.commit).to be_a Hash
162
+ end
163
+
164
+ it "should be @commit" do
165
+ expect(rr.commit).to be(@commit)
166
+ end
167
+
168
+ it "should have a format" do
169
+ expect(rr.format.to_s).to match('markdown')
170
+ end
171
+
172
+ it "should be a Gollum::Page after save" do
173
+ rr.save
174
+ expect(rr.gollum_page).to be_a Gollum::Page
175
+ end
176
+
158
177
  end
178
+
159
179
  it "should test setters" do
160
180
  rr = RailsModel.new
161
181
  rr.name=("google").should == "google"
@@ -163,12 +183,34 @@ describe "Gollum Page" do
163
183
  rr.content=("content").should == "content"
164
184
  rr.format=(:markdown).should == :markdown
165
185
  end
166
-
167
-
168
- it "should test find or initialize" do
169
- rr = RailsModel.new @call
170
- rr.save
171
- RailsModel.find_or_initialize_by_name(@call[:name], @commit).should be_a GollumRails::Page
186
+
187
+ it "tests the find method to return nil if no page was found" do
188
+ expect(RailsModel.find('whoooohoo')).to be_nil
189
+ end
190
+
191
+ it "tests the find method to return a gollum_rails:page if a page was found" do
192
+ expect(RailsModel.find('Goole')).to be_a GollumRails::Page
193
+ end
194
+
195
+ it 'should not be persisted on initialization or finding' do
196
+ init = RailsModel.find_or_initialize_by_name('totallybad', @commit)
197
+ expect(init.persisted?).to be_false
198
+ end
199
+
200
+ it "should find the page without a commit if it exists" do
201
+ expect(RailsModel.find_or_initialize_by_name("Goole").persisted?).to be_true
202
+ end
203
+
204
+ it "should find the page with a commit if it exists" do
205
+ expect(RailsModel.find_or_initialize_by_name("Goole", @commit).persisted?).to be_true
206
+ end
207
+
208
+ it "should be valid on initialization or finding" do
209
+ init = RailsModel.find_or_initialize_by_name('whoooohooo', @commit)
210
+ expect(init.valid?).to be_true
211
+
212
+ #RailsModel.find_or_initialize_by_name(@call[:name], @commit).should be_a GollumRails::Page
213
+
172
214
  end
173
215
  end
174
216
  describe "callbacks" do
@@ -237,29 +279,35 @@ describe "Gollum Page" do
237
279
  class Callbackt < GollumRails::Page
238
280
  validates_presence_of :name
239
281
  end
282
+
240
283
  cla = Callbackt.new @call
241
284
  cla.valid?.should be_true
242
285
  end
286
+
243
287
  class SugarBaby < GollumRails::Page
244
288
  validates_presence_of :name
245
289
  validates_length_of :name, :minimum => 20
246
290
  validates_length_of :format, :maximum => 14
247
291
  end
292
+
248
293
  it "should test string validation" do
249
294
  @call[:name] = "das ist zu lang"*10
250
295
  cla = SugarBaby.new @call
251
296
  cla.valid?.should be_true
252
297
  end
298
+
253
299
  it "should test the presence validator" do
254
300
  @call[:name] = [ ]
255
301
  bla = SugarBaby.new @call
256
302
  bla.valid?.should be_false
257
303
  end
304
+
258
305
  it "should test the length validator for name" do
259
306
  @call[:name] = "das"
260
307
  res = SugarBaby.new @call
261
308
  res.valid?.should be_false
262
309
  end
310
+
263
311
  it "should test the length validator for format" do
264
312
  @call[:format] = :toolongformatstringforvalidator
265
313
  res = SugarBaby.new @call
@@ -267,21 +315,131 @@ describe "Gollum Page" do
267
315
  end
268
316
 
269
317
  end
270
- describe "the thread safety" do
271
- class ThreadModel < GollumRails::Page
272
-
273
- end
274
- it "should save " do
275
- 100.times do |time|
276
- Thread.new do
277
- ThreadModel.new(@call)
278
- ThreadModel.save.should be_a(GollumRails::Page)
279
- ThreadModel.delete(@commit).length.should == 40
280
- end
281
- end
282
-
283
- end
284
-
318
+
319
+ describe "diffing commits" do
320
+ class CommitDiff < GollumRails::Page
321
+ end
322
+
323
+ it "should display the diff commit" do
324
+ commit = {
325
+ name: "flo",
326
+ message: "commit",
327
+ email: "mosny@zyg.li"
328
+ }
329
+ call = {
330
+ name: "a Page",
331
+ content: "my content",
332
+ commit: commit,
333
+ format: :markdown
334
+ }
335
+
336
+ res = CommitDiff.new call
337
+ res.save
338
+ res.update_attributes("content",nil,:markdown, @commit)
339
+ diff = res.compare_commits(res.history.first)
340
+ expect(diff).to be_a String
341
+ expect(diff).to match(/diff/)
342
+ res.delete
343
+ end
344
+
345
+ end
346
+
347
+ describe "Filename" do
348
+ class Fns < GollumRails::Page
349
+ end
350
+ it "should assemble a filename" do
351
+ res = CommitDiff.new @call
352
+ expect(res.filename).to match(/^Goole\.md$/)
353
+ end
354
+ end
355
+
356
+ describe "Sub Page" do
357
+ class Fns < GollumRails::Page
358
+ end
359
+
360
+ it "should return nil if not persisted" do
361
+ res = CommitDiff.new @call
362
+ expect(res.sub_page?).to be_nil
363
+ end
364
+ it "should be true" do
365
+ res = CommitDiff.new @call.merge(name: '_aPage')
366
+ res.save
367
+ expect(res.sub_page?).to be_true
368
+ res.delete
369
+ end
370
+
371
+ it "should be false" do
372
+ res = CommitDiff.new @call
373
+ res.save
374
+ expect(res.sub_page?).to be_false
375
+ res.delete
376
+ end
377
+ end
378
+
379
+ describe "Current version" do
380
+ class Fns < GollumRails::Page
381
+ end
382
+
383
+ it "current version should have 7 digest" do
384
+ res = CommitDiff.new @call
385
+ res.save
386
+ expect(res.current_version.length).to be(7)
387
+ res.delete
388
+ end
389
+
390
+ it "should be nil if page has not been set" do
391
+ res = CommitDiff.new @call
392
+ expect(res.current_version).to be_nil
393
+ end
285
394
 
286
- end
395
+ it "should be the latest version of the page but shortened" do
396
+ res = CommitDiff.new @call
397
+ res.save
398
+ expect(res.gollum_page.version.to_s).to match(res.current_version)
399
+ res.delete
400
+ end
401
+ it "should display the long version" do
402
+ res = CommitDiff.new @call
403
+ res.save
404
+ expect(res.gollum_page.version.to_s).to match(/^#{res.current_version(true)}$/)
405
+ res.delete
406
+ end
407
+
408
+ end
409
+
410
+ describe 'History' do
411
+ class Fns < GollumRails::Page
412
+ end
413
+
414
+ it "history should return nil if no gollum_page was saved" do
415
+ res = Fns.new @call
416
+ expect(res.history).to be_nil
417
+ end
418
+
419
+ it "history should return the pages versions if there are changes" do
420
+ res = Fns.new @call
421
+ res.save
422
+ expect(res.history).to be_a Array
423
+ res.delete
424
+ end
425
+
426
+ end
427
+
428
+ # describe "the thread safety" do
429
+ # class ThreadModel < GollumRails::Page
430
+ #
431
+ # end
432
+ # it "should save " do
433
+ # 100.times do |time|
434
+ # Thread.new do
435
+ # ThreadModel.new(@call)
436
+ # ThreadModel.save.should be_a(GollumRails::Page)
437
+ # ThreadModel.delete(@commit).length.should == 40
438
+ # end
439
+ # end
440
+ #
441
+ # end
442
+
443
+
444
+ #end
287
445
  end
data/spec/spec_helper.rb CHANGED
@@ -7,37 +7,14 @@ Coveralls.wear!
7
7
  require 'gollum_rails'
8
8
 
9
9
 
10
- require 'benchmark'
11
- RSpec::Matchers.define :take_less_than do |n|
12
- chain :seconds do; end
13
- match do |block|
14
- @elapsed = Benchmark.realtime do
15
- block.call
16
- end
17
- @elapsed <= n
18
- end
19
- end
20
10
 
21
11
  RSpec.configure do |config|
22
12
  config.treat_symbols_as_metadata_keys_with_true_values = true
23
13
 
24
- config.backtrace_clean_patterns = [
25
- /\/lib\d*\/ruby\//,
26
- /bin\//,
27
- /gems/,
28
- /spec\/spec_helper\.rb/,
29
- /lib\/rspec\/(core|expectations|matchers|mocks)/
30
- ]
31
14
  config.before(:each) do
32
15
  GollumRails::Adapters::Gollum::Connector.enabled = true
33
16
  end
34
- config.full_backtrace= false # save the console
35
- config.color_enabled= true # save your eyes
36
- config.formatter = :documentation
37
17
 
38
18
  config.mock_with :rr
39
-
40
- config.before(:each) do
41
- end
42
19
 
43
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Kasper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-27 00:00:00.000000000 Z
11
+ date: 2013-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -88,6 +88,7 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - Gemfile
90
90
  - Gemfile.lock
91
+ - Guardfile
91
92
  - HISTORY.md
92
93
  - LICENSE
93
94
  - README.md
@@ -125,7 +126,6 @@ files:
125
126
  - spec/gollum_rails/respository_spec.rb
126
127
  - spec/gollum_rails/setup_spec.rb
127
128
  - spec/gollum_rails/wiki_spec.rb
128
- - spec/spec.opts
129
129
  - spec/spec_helper.rb
130
130
  homepage: https://github.com/nirnanaaa/gollum_rails
131
131
  licenses:
data/spec/spec.opts DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --format progress
3
-