elskwid-munger 0.1.4.4 → 0.1.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  # Gem::manage_gems
3
3
  require 'rake/gempackagetask'
4
4
  require 'rake/rdoctask'
5
- require 'spec/rake/spectask'
5
+ require 'rspec/core/rake_task'
6
6
 
7
7
  spec = eval(File.new('munger.gemspec','r').read)
8
8
 
@@ -15,20 +15,13 @@ task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
15
15
  end
16
16
 
17
17
  desc 'Run specs'
18
- Spec::Rake::SpecTask.new do |t|
19
- t.spec_opts = ['--format', 'specdoc', '--colour', '--diff']
20
- end
18
+ RSpec::Core::RakeTask.new
21
19
 
22
20
  desc 'Generate coverage reports'
23
- Spec::Rake::SpecTask.new('spec:coverage') do |t|
21
+ RSpec::Core::RakeTask.new('spec:coverage') do |t|
24
22
  t.rcov = true
25
23
  end
26
24
 
27
- desc 'Generate a nice HTML report of spec results'
28
- Spec::Rake::SpecTask.new('spec:report') do |t|
29
- t.spec_opts = ['--format', 'html:report.html', '--diff']
30
- end
31
-
32
25
  task :doc => [:rdoc]
33
26
  namespace :doc do
34
27
  Rake::RDocTask.new do |rdoc|
@@ -36,15 +36,18 @@ module Munger #:nodoc:
36
36
  @report.columns.each do |column|
37
37
  # TODO: Should be able to see if a column is 'sortable'
38
38
  # Assume all columns are sortable here - for now.
39
- sorted_state = 'unsorted'
40
- direction = 'asc'
39
+ state = 'unsorted'
40
+ order = 'desc'
41
+ direction_class = ""
42
+
41
43
  if [column.to_s, @report.column_data_field(column)].include?(@options[:sort])
42
- sorted_state = "sorted"
43
- direction = @options[:order] == 'asc' ? 'desc' : 'asc'
44
- direction_class = "sorted-#{direction}"
44
+ state = "sorted"
45
+ order = @options[:order] || 'asc'
46
+ direction_class = "sorted-#{order}"
45
47
  end
46
- new_params = @options[:params].merge({'sort' => @report.column_data_field(column),'order' => direction})
47
- x.th(:class => "columnTitle #{sorted_state} #{direction_class}" ) do
48
+
49
+ new_params = @options[:params].merge({'sort' => @report.column_data_field(column),'order' => (order == 'asc' ? 'desc' : 'asc')})
50
+ x.th(:class => "columnTitle #{state} #{direction_class}") do
48
51
  # x << @report.column_title(column)
49
52
  x << "<a href=\"#{@options[:url]}?#{create_querystring(new_params)}\">#{@report.column_title(column)}</a>"
50
53
  end
data/munger.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = "elskwid-munger"
4
- s.version = "0.1.4.4"
4
+ s.version = "0.1.4.5"
5
5
  s.authors = ['Scott Chacon', 'Brandon Mitchell', 'Don Morrison', 'Eric Lindvall']
6
6
  s.email = "elskwid@gmail.com"
7
7
  s.summary = "A reporting engine in Ruby - the elskwid fork!"
@@ -166,7 +166,7 @@ describe Munger::Data do
166
166
  array = @data.to_a([:name, :age])
167
167
  array.should be_a_kind_of(Array)
168
168
  array.first.size.should eql(2)
169
- scotts = array.select { |a| a.include? ('Scott') }
169
+ scotts = array.select { |a| a.include?('Scott') }
170
170
  scotts.first.should include('Scott', 23)
171
171
  end
172
172
 
@@ -13,6 +13,16 @@ describe Munger::Render do
13
13
  html.should have_tag('table')
14
14
  end
15
15
 
16
+ it "should render sortable html" do
17
+ html = Munger::Render.to_sortable_html(@report, :sort => "name", :order => "asc", :url => "test")
18
+ html.should have_tag("table")
19
+ html.should have_tag("th.unsorted")
20
+ html.should have_tag("th.sorted")
21
+ html.should have_tag("th.sorted-asc")
22
+ html.should have_tag('a[@href="test?order=asc&sort=score"', /score/)
23
+ html.should have_tag('a[@href="test?order=desc&sort=name"', /name/)
24
+ end
25
+
16
26
  it "should render text" do
17
27
  text = Munger::Render.to_text(@report)
18
28
  text.should_not have_tag('table')
@@ -25,4 +35,4 @@ describe Munger::Render do
25
35
 
26
36
  it "should render pdf"
27
37
 
28
- end
38
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../lib/munger")
2
2
 
3
3
  require 'rubygems'
4
- require 'spec'
4
+ require 'rspec'
5
5
  require 'fileutils'
6
6
  require 'logger'
7
7
  require 'pp'
8
8
  require 'date'
9
9
 
10
- require 'rspec_hpricot_matchers'
11
- Spec::Runner.configure do |config|
12
- config.include(RspecHpricotMatchers)
10
+ require 'rspec-hpricot-matchers'
11
+ RSpec.configure do |config|
12
+ config.include(HpricotSpec::Matchers)
13
13
  end
14
14
 
15
15
  module MungerSpecHelper
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elskwid-munger
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 93
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
9
  - 4
9
- - 4
10
- version: 0.1.4.4
10
+ - 5
11
+ version: 0.1.4.5
11
12
  platform: ruby
12
13
  authors:
13
14
  - Scott Chacon
@@ -18,8 +19,7 @@ autorequire:
18
19
  bindir: bin
19
20
  cert_chain: []
20
21
 
21
- date: 2010-09-04 00:00:00 -07:00
22
- default_executable:
22
+ date: 2012-01-08 00:00:00 Z
23
23
  dependencies: []
24
24
 
25
25
  description:
@@ -57,7 +57,6 @@ files:
57
57
  - spec/munger/render/csv_spec.rb
58
58
  - spec/munger/render/html_spec.rb
59
59
  - spec/munger/render/text_spec.rb
60
- has_rdoc: true
61
60
  homepage: http://github.com/elskwid/munger
62
61
  licenses: []
63
62
 
@@ -67,23 +66,27 @@ rdoc_options: []
67
66
  require_paths:
68
67
  - lib
69
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
+ hash: 3
73
74
  segments:
74
75
  - 0
75
76
  version: "0"
76
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
77
79
  requirements:
78
80
  - - ">="
79
81
  - !ruby/object:Gem::Version
82
+ hash: 3
80
83
  segments:
81
84
  - 0
82
85
  version: "0"
83
86
  requirements: []
84
87
 
85
88
  rubyforge_project:
86
- rubygems_version: 1.3.6
89
+ rubygems_version: 1.8.11
87
90
  signing_key:
88
91
  specification_version: 3
89
92
  summary: A reporting engine in Ruby - the elskwid fork!