spec/support/shared_examples/operator/single_input.rb in danica-2.7.4 vs spec/support/shared_examples/operator/single_input.rb in danica-2.7.5
- old
+ new
@@ -1,10 +1,13 @@
+# frozen_string_literal: true
+
shared_examples 'a operator with a single input value' do |arguments|
- include_context 'variables are initialized', arguments, *%w(variable_value expected_number expected_tex expected_number_tex expected_gnu expected_number_gnu)
- let(:variable) { { name: "X", value: variable_value } }
+ include_context 'when variables are initialized', arguments, 'variable_value', 'expected_number', 'expected_tex', 'expected_number_tex', 'expected_gnu', 'expected_number_gnu'
subject { described_class.new(variable) }
+ let(:variable) { { name: 'X', value: variable_value } }
+
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(expected_number)
end
@@ -38,10 +41,11 @@
context 'when the variable is numeric' do
before do
subject.variables[0].value = variable_value
end
+
it 'prints both numbers' do
expect(subject.to_tex).to eq(expected_number_tex)
end
end
end
@@ -57,9 +61,10 @@
context 'when the variable is numeric' do
before do
subject.variables[0].value = variable_value
end
+
it 'prints both numbers' do
expect(subject.to_gnu).to eq(expected_number_gnu)
end
end
end