motiro 0.6.5 → 0.6.6

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.
@@ -41,7 +41,7 @@ class DarcsReporterTest < Test::Unit::TestCase
41
41
  assert_equal 'thiago.arrais', hl.author
42
42
  assert_equal 'Some refactoring after the mess', hl.description
43
43
  assert_equal Time.utc(2006, 7, 17, 20, 9, 39), hl.happened_at
44
- assert_equal '20060717200939-49d33-c04fbb63892ae64cd96d1ad8f1ad2dd0a6e8e7da.gz',
44
+ assert_equal '20060717200939-49d33-c04fbb63892ae64cd96d1ad8f1ad2dd0a6e8e7da',
45
45
  hl.rid
46
46
  assert_equal 'darcs', hl.reported_by
47
47
  end
@@ -49,7 +49,7 @@ class DarcsReporterTest < Test::Unit::TestCase
49
49
  def test_fetches_headline_details
50
50
  @darcs_changes = P1
51
51
 
52
- rid = '20060717200939-49d33-c04fbb63892ae64cd96d1ad8f1ad2dd0a6e8e7da.gz'
52
+ rid = '20060717200939-49d33-c04fbb63892ae64cd96d1ad8f1ad2dd0a6e8e7da'
53
53
  hl = @reporter.headline(rid)
54
54
 
55
55
  assert_equal 'thiago.arrais', hl.author
@@ -90,6 +90,19 @@ class WikiReporterTest < Test::Unit::TestCase
90
90
  end
91
91
  end
92
92
 
93
+ def test_provides_includes_page_text_in_headline_description
94
+ FlexMock.use do |page_provider|
95
+ page_provider.should_receive(:find).
96
+ zero_or_more_times.
97
+ and_return([Page.new(:name => 'SomePage').revise(bob, now,
98
+ :title => 'Some title',
99
+ :text => 'Here goes some text for some wiki page')])
100
+ hl = FeaturesReporter.new(:page_provider => page_provider).headlines[0]
101
+ assert_equal "Some title\n\nHere goes some text for some wiki page", hl.description
102
+ assert_equal 'Some title', hl.title
103
+ end
104
+ end
105
+
93
106
  def test_respond_to_latest_headlines
94
107
  FlexMock.use do |page_provider|
95
108
  page_provider.should_receive(:find).zero_or_more_times.and_return([])
@@ -0,0 +1,53 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 Thiago Arrais
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ module ActionController::Routing
19
+ class MotiroSegment < DynamicSegment
20
+ def match_extraction(next_capture)
21
+ "imatch = match[#{next_capture}].match(/-/)\n" +
22
+ "params[:page_name] = imatch ? imatch.pre_match : match[#{next_capture}]\n" +
23
+ "params[:locale] = imatch.post_match unless imatch.nil?"
24
+ end
25
+
26
+ def extraction_code
27
+ s = "page_name_value = hash[:page_name] && hash[:page_name].clone"
28
+ s << "\nreturn [nil, nil] if page_name_value.nil?"
29
+ s << "\n#{expiry_statement}"
30
+
31
+ s << "\nlocale_value = hash[:locale]"
32
+ s << "\noptions.delete(:locale)"
33
+ s << "\nexpired, hash = true, options if !expired && expire_on[:locale]"
34
+ s << "\npage_name_value << '-' << locale_value unless locale_value.nil?"
35
+ end
36
+ end
37
+
38
+ class MotiroRouteBuilder < RouteBuilder
39
+ def segment_for(string)
40
+ if string.match(/\A:page_name/)
41
+ [MotiroSegment.new(:page_name), $~.post_match]
42
+ else
43
+ super
44
+ end
45
+ end
46
+ end
47
+
48
+ class RouteSet
49
+ def builder
50
+ @builder ||= MotiroRouteBuilder.new
51
+ end
52
+ end
53
+ end