spec/lib/danica/function/square_root_spec.rb in danica-0.3.0 vs spec/lib/danica/function/square_root_spec.rb in danica-1.0.0
- old
+ new
@@ -5,11 +5,11 @@
let(:variable) { { name: "X", value: 9 } }
let(:subject) do
described_class.new(variable: variable)
end
- describe 'to_f' do
+ describe '#to_f' do
context 'when variables are not numbers but have value' do
it 'returns the division of the values' do
expect(subject.to_f).to eq(3.0)
end
@@ -29,11 +29,11 @@
expect(subject.to_f).to be_a(Float)
end
end
end
- describe 'to_tex' do
+ describe '#to_tex' do
context 'when variables have no value' do
let(:variable) { :X }
it 'returns a latex format fraction' do
expect(subject.to_tex).to eq('\sqrt{X}')
@@ -47,7 +47,25 @@
it 'prints both numbers' do
expect(subject.to_tex).to eq('3')
end
end
end
-end
+ describe '#to_gnu' do
+ context 'when variables have no value' do
+ let(:variable) { :X }
+
+ it 'returns a latex format fraction' do
+ expect(subject.to_gnu).to eq('sqrt(X)')
+ end
+ end
+
+ context 'when the variable is numeric' do
+ before do
+ subject.variable.value = 9
+ end
+ it 'prints both numbers' do
+ expect(subject.to_gnu).to eq('3')
+ end
+ end
+ end
+end