danica 2.7.4 → 2.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +28 -0
  3. data/.gitignore +6 -1
  4. data/.rubocop.yml +9 -0
  5. data/.rubocop_todo.yml +100 -0
  6. data/Dockerfile +26 -0
  7. data/Gemfile +2 -1
  8. data/Rakefile +4 -0
  9. data/config/rubycritc.rb +12 -0
  10. data/config/yardstick.rb +13 -0
  11. data/config/yardstick.yml +33 -0
  12. data/danica.gemspec +14 -7
  13. data/docker-compose.yml +14 -9
  14. data/lib/danica.rb +2 -1
  15. data/lib/danica/base_operations.rb +2 -0
  16. data/lib/danica/builder.rb +2 -0
  17. data/lib/danica/common.rb +5 -2
  18. data/lib/danica/dsl.rb +8 -6
  19. data/lib/danica/dsl/builder.rb +3 -1
  20. data/lib/danica/equation.rb +3 -3
  21. data/lib/danica/equation/builder.rb +2 -0
  22. data/lib/danica/exception.rb +3 -2
  23. data/lib/danica/expressable.rb +14 -8
  24. data/lib/danica/expression.rb +4 -2
  25. data/lib/danica/expression/gauss.rb +5 -5
  26. data/lib/danica/formatted.rb +4 -2
  27. data/lib/danica/function.rb +5 -3
  28. data/lib/danica/function/name.rb +2 -0
  29. data/lib/danica/operator.rb +12 -9
  30. data/lib/danica/operator/addition.rb +4 -3
  31. data/lib/danica/operator/chained.rb +4 -3
  32. data/lib/danica/operator/cos.rb +2 -1
  33. data/lib/danica/operator/division.rb +2 -1
  34. data/lib/danica/operator/exponential.rb +2 -1
  35. data/lib/danica/operator/functional.rb +3 -2
  36. data/lib/danica/operator/multiplication.rb +4 -2
  37. data/lib/danica/operator/power.rb +4 -3
  38. data/lib/danica/operator/sin.rb +2 -1
  39. data/lib/danica/operator/squared_root.rb +2 -1
  40. data/lib/danica/variables_holder.rb +7 -4
  41. data/lib/danica/variables_holder/alias_builder.rb +4 -4
  42. data/lib/danica/variables_holder/calculator.rb +2 -0
  43. data/lib/danica/variables_holder/store.rb +3 -2
  44. data/lib/danica/variables_holder/variables_builder.rb +2 -1
  45. data/lib/danica/version.rb +3 -1
  46. data/lib/danica/wrapper.rb +11 -9
  47. data/lib/danica/wrapper/constant.rb +9 -14
  48. data/lib/danica/wrapper/container.rb +2 -3
  49. data/lib/danica/wrapper/group.rb +2 -2
  50. data/lib/danica/wrapper/negative.rb +2 -1
  51. data/lib/danica/wrapper/number.rb +4 -3
  52. data/lib/danica/wrapper/plus_minus.rb +2 -1
  53. data/lib/danica/wrapper/variable.rb +10 -8
  54. data/scripts/check_readme.sh +6 -0
  55. data/scripts/rubycritic.sh +10 -0
  56. data/spec/integration/global/danica/formatted_spec.rb +87 -0
  57. data/spec/integration/global/danica/operator/addition_spec.rb +32 -0
  58. data/spec/integration/{multiplication_spec.rb → global/danica/operator/multiplication_spec.rb} +12 -9
  59. data/spec/integration/{power_spec.rb → global/danica/operator/power_spec.rb} +4 -2
  60. data/spec/integration/{negative_spec.rb → global/danica/wrapper/negative_spec.rb} +9 -8
  61. data/spec/integration/{plus_minus_spec.rb → global/danica/wrapper/plus_minus_spec.rb} +5 -4
  62. data/spec/integration/readme/constant_spec.rb +4 -1
  63. data/spec/integration/readme/danica/formatted_spec.rb +24 -0
  64. data/spec/integration/readme/danica_spec.rb +20 -4
  65. data/spec/integration/readme/equation_spec.rb +4 -2
  66. data/spec/integration/readme/expression_spec.rb +11 -8
  67. data/spec/integration/readme/function_spec.rb +11 -7
  68. data/spec/integration/readme/number_spec.rb +9 -8
  69. data/spec/integration/readme/operator_spec.rb +3 -1
  70. data/spec/integration/readme/variables_spec.rb +8 -6
  71. data/spec/lib/danica/common_spec.rb +23 -9
  72. data/spec/lib/danica/dsl_spec.rb +5 -2
  73. data/spec/lib/danica/equation_spec.rb +10 -8
  74. data/spec/lib/danica/expressable_spec.rb +5 -2
  75. data/spec/lib/danica/expression/gauss_spec.rb +6 -3
  76. data/spec/lib/danica/expression_spec.rb +48 -26
  77. data/spec/lib/danica/formatted_spec.rb +20 -14
  78. data/spec/lib/danica/function/name_spec.rb +3 -1
  79. data/spec/lib/danica/function_spec.rb +14 -10
  80. data/spec/lib/danica/operator/addition_spec.rb +16 -15
  81. data/spec/lib/danica/operator/cos_spec.rb +9 -8
  82. data/spec/lib/danica/operator/division_spec.rb +18 -17
  83. data/spec/lib/danica/operator/exponential_spec.rb +9 -8
  84. data/spec/lib/danica/operator/multiplication_spec.rb +16 -15
  85. data/spec/lib/danica/operator/power_spec.rb +17 -16
  86. data/spec/lib/danica/operator/sin_spec.rb +9 -8
  87. data/spec/lib/danica/operator/squared_root_spec.rb +9 -8
  88. data/spec/lib/danica/operator_spec.rb +13 -4
  89. data/spec/lib/danica/variables_holder/store_spec.rb +19 -13
  90. data/spec/lib/danica/variables_holder_spec.rb +76 -59
  91. data/spec/lib/danica/wrapper/constant_spec.rb +9 -2
  92. data/spec/lib/danica/wrapper/group_spec.rb +4 -1
  93. data/spec/lib/danica/wrapper/negative_spec.rb +4 -1
  94. data/spec/lib/danica/wrapper/number_spec.rb +8 -3
  95. data/spec/lib/danica/wrapper/plus_minus_spec.rb +4 -1
  96. data/spec/lib/danica/wrapper/variable_spec.rb +6 -3
  97. data/spec/lib/danica/wrapper_spec.rb +14 -12
  98. data/spec/lib/danica_spec.rb +6 -5
  99. data/spec/spec_helper.rb +2 -1
  100. data/spec/support/models/expression/baskara.rb +3 -3
  101. data/spec/support/models/expression/parabole.rb +2 -0
  102. data/spec/support/models/expression/quadratic_sum.rb +3 -1
  103. data/spec/support/models/expression/spatial.rb +2 -1
  104. data/spec/support/models/function/my_function.rb +3 -1
  105. data/spec/support/models/function/parabole.rb +1 -1
  106. data/spec/support/models/function/quadratic_sum.rb +2 -0
  107. data/spec/support/models/function/spatial.rb +2 -0
  108. data/spec/support/models/operator/inverse.rb +3 -1
  109. data/spec/support/models/operator/my_operator.rb +3 -1
  110. data/spec/support/models/variables_holder/dummy.rb +3 -1
  111. data/spec/support/shared_contexts/common.rb +4 -2
  112. data/spec/support/shared_examples/base_operations.rb +7 -4
  113. data/spec/support/shared_examples/common.rb +3 -1
  114. data/spec/support/shared_examples/operator/chained.rb +12 -6
  115. data/spec/support/shared_examples/operator/dual_term.rb +9 -8
  116. data/spec/support/shared_examples/operator/single_input.rb +7 -2
  117. data/spec/support/shared_examples/variable.rb +8 -4
  118. metadata +109 -30
  119. data/spec/integration/addition_spec.rb +0 -28
  120. data/spec/integration/formatted_spec.rb +0 -75
  121. data/spec/integration/readme/formatting_spec.rb +0 -34
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  shared_examples 'a operator with a single input value' do |arguments|
2
- include_context 'variables are initialized', arguments, *%w(variable_value expected_number expected_tex expected_number_tex expected_gnu expected_number_gnu)
3
- let(:variable) { { name: "X", value: variable_value } }
4
+ include_context 'when variables are initialized', arguments, 'variable_value', 'expected_number', 'expected_tex', 'expected_number_tex', 'expected_gnu', 'expected_number_gnu'
4
5
  subject { described_class.new(variable) }
5
6
 
7
+ let(:variable) { { name: 'X', value: variable_value } }
8
+
6
9
  describe '#to_f' do
7
10
  context 'when variables are not numbers but have value' do
8
11
  it 'returns the division of the values' do
@@ -40,6 +43,7 @@ shared_examples 'a operator with a single input value' do |arguments|
40
43
  before do
41
44
  subject.variables[0].value = variable_value
42
45
  end
46
+
43
47
  it 'prints both numbers' do
44
48
  expect(subject.to_tex).to eq(expected_number_tex)
45
49
  end
@@ -59,6 +63,7 @@ shared_examples 'a operator with a single input value' do |arguments|
59
63
  before do
60
64
  subject.variables[0].value = variable_value
61
65
  end
66
+
62
67
  it 'prints both numbers' do
63
68
  expect(subject.to_gnu).to eq(expected_number_gnu)
64
69
  end
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  shared_examples 'a variable method to formated string' do |method, format|
4
+ subject { described_class.new(arguments) }
5
+
2
6
  let(:name) { :delta }
3
7
  let(:value) { 10.0 }
4
8
  let(:arguments) { { name: name, latex: '\delta', gnuplot: 'del' } }
5
- subject { described_class.new(arguments) }
6
9
 
7
10
  context "when #{format} is not defined" do
8
11
  before { arguments.delete(format) }
@@ -13,6 +16,7 @@ shared_examples 'a variable method to formated string' do |method, format|
13
16
 
14
17
  context 'when value is defined' do
15
18
  before { arguments[:value] = value }
19
+
16
20
  it_behaves_like 'a method that display the numeric value', method
17
21
  end
18
22
  end
@@ -32,7 +36,7 @@ shared_examples 'a method that display the numeric value' do |method|
32
36
  expect(subject.public_send(method)).to eq('10')
33
37
  end
34
38
 
35
- context 'and passing the decimals argument' do
39
+ context 'when passing the decimals argument' do
36
40
  it 'returns the value float string' do
37
41
  expect(subject.public_send(method, decimals: 4)).to eq('10')
38
42
  end
@@ -46,13 +50,13 @@ shared_examples 'a method that display the numeric value' do |method|
46
50
  expect(subject.public_send(method)).to eq('3.3333333333333335')
47
51
  end
48
52
 
49
- context 'and passing the decimals argument' do
53
+ context 'when passing the decimals argument' do
50
54
  it 'returns the value float string' do
51
55
  expect(subject.public_send(method, decimals: 4)).to eq('3.3333')
52
56
  end
53
57
  end
54
58
 
55
- context 'but the number has less decimals' do
59
+ context 'when the number has less decimals' do
56
60
  let(:value) { 10.5 }
57
61
 
58
62
  it 'returns the value integer string' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danica
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darthjee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-27 00:00:00.000000000 Z
11
+ date: 2019-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,72 +44,142 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.6'
47
+ version: 1.16.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.6'
54
+ version: 1.16.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry-nav
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.2.4
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.2.4
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: 12.3.1
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: 12.3.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '3.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '3.8'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.58.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.58.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.30.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.30.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubycritic
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 4.0.2
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 4.0.2
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
71
141
  requirement: !ruby/object:Gem::Requirement
72
142
  requirements:
73
143
  - - "~>"
74
144
  - !ruby/object:Gem::Version
75
- version: '2.14'
145
+ version: 0.16.x
76
146
  type: :development
77
147
  prerelease: false
78
148
  version_requirements: !ruby/object:Gem::Requirement
79
149
  requirements:
80
150
  - - "~>"
81
151
  - !ruby/object:Gem::Version
82
- version: '2.14'
152
+ version: 0.16.x
83
153
  - !ruby/object:Gem::Dependency
84
- name: rspec-mocks
154
+ name: yard
85
155
  requirement: !ruby/object:Gem::Requirement
86
156
  requirements:
87
157
  - - ">="
88
158
  - !ruby/object:Gem::Version
89
- version: '0'
159
+ version: 0.9.18
90
160
  type: :development
91
161
  prerelease: false
92
162
  version_requirements: !ruby/object:Gem::Requirement
93
163
  requirements:
94
164
  - - ">="
95
165
  - !ruby/object:Gem::Version
96
- version: '0'
166
+ version: 0.9.18
97
167
  - !ruby/object:Gem::Dependency
98
- name: pry-nav
168
+ name: yardstick
99
169
  requirement: !ruby/object:Gem::Requirement
100
170
  requirements:
101
171
  - - ">="
102
172
  - !ruby/object:Gem::Version
103
- version: '0'
173
+ version: 0.9.9
104
174
  type: :development
105
175
  prerelease: false
106
176
  version_requirements: !ruby/object:Gem::Requirement
107
177
  requirements:
108
178
  - - ">="
109
179
  - !ruby/object:Gem::Version
110
- version: '0'
180
+ version: 0.9.9
111
181
  - !ruby/object:Gem::Dependency
112
- name: simplecov
182
+ name: rspec-mocks
113
183
  requirement: !ruby/object:Gem::Requirement
114
184
  requirements:
115
185
  - - ">="
@@ -129,13 +199,20 @@ executables: []
129
199
  extensions: []
130
200
  extra_rdoc_files: []
131
201
  files:
202
+ - ".circleci/config.yml"
132
203
  - ".gitignore"
133
204
  - ".rspec"
205
+ - ".rubocop.yml"
206
+ - ".rubocop_todo.yml"
207
+ - Dockerfile
134
208
  - Gemfile
135
209
  - LICENSE
136
210
  - README.md
137
211
  - Rakefile
138
212
  - circle.yml
213
+ - config/rubycritc.rb
214
+ - config/yardstick.rb
215
+ - config/yardstick.yml
139
216
  - danica.gemspec
140
217
  - docker-compose.yml
141
218
  - lib/danica.rb
@@ -178,17 +255,19 @@ files:
178
255
  - lib/danica/wrapper/number.rb
179
256
  - lib/danica/wrapper/plus_minus.rb
180
257
  - lib/danica/wrapper/variable.rb
181
- - spec/integration/addition_spec.rb
182
- - spec/integration/formatted_spec.rb
183
- - spec/integration/multiplication_spec.rb
184
- - spec/integration/negative_spec.rb
185
- - spec/integration/plus_minus_spec.rb
186
- - spec/integration/power_spec.rb
258
+ - scripts/check_readme.sh
259
+ - scripts/rubycritic.sh
260
+ - spec/integration/global/danica/formatted_spec.rb
261
+ - spec/integration/global/danica/operator/addition_spec.rb
262
+ - spec/integration/global/danica/operator/multiplication_spec.rb
263
+ - spec/integration/global/danica/operator/power_spec.rb
264
+ - spec/integration/global/danica/wrapper/negative_spec.rb
265
+ - spec/integration/global/danica/wrapper/plus_minus_spec.rb
187
266
  - spec/integration/readme/constant_spec.rb
267
+ - spec/integration/readme/danica/formatted_spec.rb
188
268
  - spec/integration/readme/danica_spec.rb
189
269
  - spec/integration/readme/equation_spec.rb
190
270
  - spec/integration/readme/expression_spec.rb
191
- - spec/integration/readme/formatting_spec.rb
192
271
  - spec/integration/readme/function_spec.rb
193
272
  - spec/integration/readme/number_spec.rb
194
273
  - spec/integration/readme/operator_spec.rb
@@ -259,22 +338,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
338
  version: '0'
260
339
  requirements: []
261
340
  rubyforge_project:
262
- rubygems_version: 2.6.11
341
+ rubygems_version: 2.7.6
263
342
  signing_key:
264
343
  specification_version: 4
265
344
  summary: Danica
266
345
  test_files:
267
- - spec/integration/addition_spec.rb
268
- - spec/integration/formatted_spec.rb
269
- - spec/integration/multiplication_spec.rb
270
- - spec/integration/negative_spec.rb
271
- - spec/integration/plus_minus_spec.rb
272
- - spec/integration/power_spec.rb
346
+ - spec/integration/global/danica/formatted_spec.rb
347
+ - spec/integration/global/danica/operator/addition_spec.rb
348
+ - spec/integration/global/danica/operator/multiplication_spec.rb
349
+ - spec/integration/global/danica/operator/power_spec.rb
350
+ - spec/integration/global/danica/wrapper/negative_spec.rb
351
+ - spec/integration/global/danica/wrapper/plus_minus_spec.rb
273
352
  - spec/integration/readme/constant_spec.rb
353
+ - spec/integration/readme/danica/formatted_spec.rb
274
354
  - spec/integration/readme/danica_spec.rb
275
355
  - spec/integration/readme/equation_spec.rb
276
356
  - spec/integration/readme/expression_spec.rb
277
- - spec/integration/readme/formatting_spec.rb
278
357
  - spec/integration/readme/function_spec.rb
279
358
  - spec/integration/readme/number_spec.rb
280
359
  - spec/integration/readme/operator_spec.rb
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'integration of addition' do
4
- describe 'with negative and positivenegative (+/-) numbers' do
5
- subject do
6
- Danica::Operator::Addition.new(
7
- Danica::Wrapper::Negative.new(1),
8
- 2,
9
- -3,
10
- 4,
11
- Danica::Wrapper::PlusMinus.new(5),
12
- Danica::Wrapper::Number.new(-6)
13
- )
14
- end
15
-
16
- describe '#to_gnu' do
17
- it 'returns the correct string' do
18
- expect(subject.to_gnu).to eq('-1 + 2 -3 + 4 + 5 -6')
19
- end
20
- end
21
-
22
- describe '#to_tex' do
23
- it 'returns the correct string' do
24
- expect(subject.to_tex).to eq('-1 + 2 -3 + 4 \pm 5 -6')
25
- end
26
- end
27
- end
28
- end
@@ -1,75 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'integration of formatted objects' do
4
- let(:variable) { Danica.build(:v) { v } }
5
- subject do
6
- variable.tex
7
- end
8
-
9
- context 'when interacting with a multiplication' do
10
- let(:other) do
11
- Danica.build(:x, :y) { x * y }
12
- end
13
- context 'when multipling another multiplication' do
14
- let(:result) { subject * other }
15
- it do
16
- expect(result).to be_a(Danica::Formatted)
17
- end
18
-
19
- it 'knows how to convert it to string' do
20
- expect(result.to_s).to eq('v \\cdot x \\cdot y')
21
- end
22
- end
23
-
24
- context 'when multiplicated by another multiplication' do
25
- let(:result) { other * subject }
26
- it do
27
- expect(result).to be_a(Danica::Formatted)
28
- end
29
-
30
- it 'knows how to convert it to string' do
31
- expect(result.to_s).to eq('x \\cdot y \\cdot v')
32
- end
33
- end
34
- end
35
-
36
- context 'when interacting with a sum' do
37
- let(:other) do
38
- Danica.build(:x, :y) { x + y }
39
- end
40
- context 'when summing another sum' do
41
- let(:result) { subject + other }
42
- it do
43
- expect(result).to be_a(Danica::Formatted)
44
- end
45
-
46
- it 'knows how to convert it to string' do
47
- expect(result.to_s).to eq('v + x + y')
48
- end
49
- end
50
-
51
- context 'when added by another sum' do
52
- let(:result) { other + subject }
53
- it do
54
- expect(result).to be_a(Danica::Formatted)
55
- end
56
-
57
- it 'knows how to convert it to string' do
58
- expect(result.to_s).to eq('x + y + v')
59
- end
60
- end
61
- end
62
-
63
- context 'when operating multiplication and subtraction all toguether' do
64
- let(:variable) { Danica::Wrapper::Variable.new(:v) }
65
- let(:x) { Danica::Wrapper::Variable.new(:x) }
66
- let(:result) { x * (-subject) }
67
- it do
68
- expect(result).to be_a(Danica::Formatted)
69
- end
70
-
71
- it 'knows how to convert it to string' do
72
- expect(result.to_s).to eq('x \cdot \left(-v\right)')
73
- end
74
- end
75
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'formatting' do
4
- subject do
5
- value = 1 / 3.0
6
- Danica.build(:x) do
7
- x + value
8
- end
9
- end
10
-
11
- describe '#to_tex' do
12
- it 'formats the output' do
13
- expect(subject.to_tex(decimals: 3)).to eq('x + 0.333')
14
- end
15
- end
16
- end
17
-
18
- describe Danica::Formatted do
19
- let(:expression) do
20
- value = 1 / 3.0
21
- Danica.build(:x) do
22
- x + value
23
- end
24
- end
25
- subject do
26
- expression.tex(decimals: 3)
27
- end
28
-
29
- describe '#to_tex' do
30
- it 'formats the output' do
31
- expect(subject.to_s).to eq('x + 0.333')
32
- end
33
- end
34
- end