ledger_web 1.4.4 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,4 +12,8 @@ end
12
12
 
13
13
  task :test do
14
14
  system 'rspec --color --format=documentation test'
15
+ end
16
+
17
+ task :install => :build do
18
+ system "gem install ledger_web-#{LedgerWeb::VERSION}.gem"
15
19
  end
@@ -36,6 +36,13 @@ module LedgerWeb
36
36
  raise "Missing params: #{not_present.join(', ')}"
37
37
  end
38
38
  end
39
+
40
+ def default(key, value)
41
+ if not Report.params.has_key? key
42
+ puts "Setting #{key} to #{value}"
43
+ Report.params[key] = value
44
+ end
45
+ end
39
46
 
40
47
  def linkify(links, row, value, display_value)
41
48
  links.each do |key, val|
Binary file
@@ -1,3 +1,3 @@
1
1
  module LedgerWeb
2
- VERSION = '1.4.4'
2
+ VERSION = '1.4.6'
3
3
  end
@@ -3,6 +3,7 @@
3
3
  <title>Ledger Web</title>
4
4
  <link rel="stylesheet" href="/bootstrap.min.css">
5
5
  <link rel="stylesheet" href="/ledger.css">
6
+ <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
6
7
  <script type="text/javascript" src="/jquery-1.7.1.min.js"></script>
7
8
  <script type="text/javascript" src="/jquery.tablesorter.min.js"></script>
8
9
  <script type="text/javascript" src="/bootstrap-dropdown.js"></script>
data/test/report_spec.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
2
  require 'ledger_web/report'
3
+ require 'ledger_web/helpers'
3
4
 
4
5
  describe LedgerWeb::Report do
5
6
  describe "#from_query" do
7
+ let(:helpers) { TestHelper.new }
6
8
  it "should run the query" do
7
9
 
8
10
  LedgerWeb::Report.session = {:from => '2012/01/01', :to => '2012/01/01'}
@@ -18,6 +20,20 @@ describe LedgerWeb::Report do
18
20
  rows[0][0][0].should eq(5)
19
21
  rows[0][0][1].should eq(LedgerWeb::Field.new('foo', 'number', 'pull-right'))
20
22
  end
23
+
24
+ it "should respect defaults" do
25
+ LedgerWeb::Report.params = {}
26
+ helpers.default('foo', 'bar')
27
+
28
+ report = LedgerWeb::Report.from_query("select :foo as foo")
29
+ rows = []
30
+ report.each_row do |row|
31
+ rows << row
32
+ end
33
+
34
+ rows[0][0][0].should eq("bar")
35
+ end
36
+
21
37
  end
22
38
 
23
39
  describe "#pivot" do
data/test/spec_helper.rb CHANGED
@@ -4,6 +4,7 @@ require 'rspec'
4
4
  require 'ledger_web/config'
5
5
  require 'ledger_web/db'
6
6
  require 'ledger_web/report'
7
+ require 'ledger_web/helpers'
7
8
  require 'database_cleaner'
8
9
 
9
10
  RSpec.configure do |config|
@@ -71,3 +72,7 @@ end
71
72
  def number_field(name)
72
73
  field(name, 'number', 'pull-right')
73
74
  end
75
+
76
+ class TestHelper
77
+ include LedgerWeb::Helpers
78
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ledger_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-24 00:00:00.000000000Z
12
+ date: 2012-04-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
@@ -283,6 +283,7 @@ files:
283
283
  - lib/ledger_web/public/codemirror/theme/night.css
284
284
  - lib/ledger_web/public/codemirror/theme/rubyblue.css
285
285
  - lib/ledger_web/public/d3.min.js
286
+ - lib/ledger_web/public/favicon.ico
286
287
  - lib/ledger_web/public/jquery-1.7.1.min.js
287
288
  - lib/ledger_web/public/jquery.tablesorter.min.js
288
289
  - lib/ledger_web/public/ledger.css