twb 0.0.36 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,17 @@
1
- # testTwbGem.rb - this Ruby script Copyright 2013, 2014 Christopher Gerrard
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
2
15
 
3
16
  require 'nokogiri'
4
17
 
@@ -1,3 +1,18 @@
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  require 'twb'
2
17
  require "test/unit"
3
18
 
@@ -0,0 +1,78 @@
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'nokogiri'
17
+
18
+ #require 'twb'
19
+ require 'C:\tech\Tableau\tools\Ruby\gems\twb\lib\twb.rb'
20
+ require "test/unit"
21
+
22
+ system "cls"
23
+
24
+ class TestFieldCalculation < Test::Unit::TestCase
25
+
26
+ def test_fragment1
27
+ doc = Nokogiri::XML::Document.parse <<-EOHTML
28
+ <calculation class='tableau' formula='abc' />
29
+ EOHTML
30
+ calcNode = doc.at_xpath('./calculation')
31
+ calc = Twb::FieldCalculation.new(calcNode)
32
+ assert(!calc.nil?)
33
+ #puts "node: #{calcNode}"
34
+ #puts "formula: #{calc.formula}"
35
+ fields = calc.fields
36
+ #puts "fields: #{fields.length}"
37
+ assert(!fields.nil?,'Calculation fields must not be nil.')
38
+ assert(fields.empty?,'Calculation fields must be empty.')
39
+ end
40
+
41
+
42
+ def test_fragment2
43
+ doc = Nokogiri::XML::Document.parse <<-EOHTML
44
+ <calculation class='tableau' formula='// this is the number of days between the order and shipment&#13;&#10;&#13;&#10;datediff(&apos;day&apos;,[Order Date] , [other].[Ship Date])' />
45
+ EOHTML
46
+ calcNode = doc.at_xpath('./calculation')
47
+ calc = Twb::FieldCalculation.new(calcNode)
48
+ assert(!calc.nil?)
49
+ #puts "node: #{calcNode}"
50
+ #puts "formula: #{calc.formula}"
51
+ fields = calc.fields
52
+ #puts "fields: #{fields.length}"
53
+ #fields.each {|e| puts "FIELD: #{e} "}
54
+ assert(!fields.nil?,'Calculation fields must not be nil.')
55
+ assert(!fields.empty?,'Calculation fields must not be empty.')
56
+ assert_equal(fields.length,2,'There must be 2 fields.')
57
+ end
58
+
59
+
60
+ def xtest_create
61
+ puts "\n\n\n == Calculated Fields Test Workbook.twb"
62
+ twb = Twb::Workbook.new('Calculated Fields Test Workbook.twb')
63
+ assert_equal(twb.name, 'Calculated Fields Test Workbook.twb')
64
+ assert(twb.instance_of?(Twb::Workbook))
65
+ dataSources = twb.datasources
66
+ assert(!dataSources.empty?)
67
+ dataSources.each do |ds|
68
+ fields = ds.localfields
69
+ assert(!fields.empty?)
70
+ fields.each do |f|
71
+ #puts "\nFIELD\n-----\n#{f}"
72
+ field = Twb::LocalField
73
+ end
74
+ end
75
+ end
76
+
77
+
78
+ end
@@ -1,4 +1,17 @@
1
- # testTwbGem.rb - this Ruby script Copyright 2013, 2014 Christopher Gerrard
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
2
15
 
3
16
  require 'nokogiri'
4
17
 
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -25,6 +25,7 @@ files:
25
25
  - lib/twb/datasource.rb
26
26
  - lib/twb/docdashboard.rb
27
27
  - lib/twb/field.rb
28
+ - lib/twb/fieldcalculation.rb
28
29
  - lib/twb/hashtohtml.rb
29
30
  - lib/twb/htmllistcollapsible.rb
30
31
  - lib/twb/localfield.rb
@@ -42,11 +43,13 @@ files:
42
43
  - lib/twb.rb
43
44
  - LICENSE.txt
44
45
  - README.txt
46
+ - test/Calculated Fields Test Workbook.twb
45
47
  - test/No Content.twb
46
48
  - test/No Dashboards.twb
47
49
  - test/testDashboardXRay.rb
48
50
  - test/testDocDashboard.rb
49
51
  - test/testDocDashboardCreate.rb
52
+ - test/testFieldCalculation.rb
50
53
  - test/testHTMLList.rb
51
54
  - test/testTwbGem.rb
52
55
  - test/testTwbWrite.rb
@@ -56,6 +59,8 @@ files:
56
59
  - twb-0.0.33.gem
57
60
  - twb-0.0.34.gem
58
61
  - twb-0.0.35.gem
62
+ - twb-0.0.36.gem
63
+ - twb-0.0.37.gem
59
64
  - twb.gemspec
60
65
  homepage: http://rubygems.org/gems/twb
61
66
  licenses: