spec/support/shared_examples/operator/dual_term.rb in danica-2.7.4 vs spec/support/shared_examples/operator/dual_term.rb in danica-2.7.5
- old
+ new
@@ -1,17 +1,19 @@
+# frozen_string_literal: true
+
shared_examples 'a operator that has two terms' do |name, arguments|
it_behaves_like 'a operator that has two terms and knows how to calculate it', name, arguments
it_behaves_like 'a operator that has two terms and knows how to call to_tex', arguments
it_behaves_like 'a operator that has two terms and knows how to call to_gnu', arguments
end
shared_examples 'a operator that has two terms and knows how to calculate it' do |name, arguments|
- include_context 'variables are initialized', arguments, *%w(values calculated)
+ include_context 'when variables are initialized', arguments, 'values', 'calculated'
let(:variables) do
- [ 1, 2 ].map do |i|
- { name: "X#{i}", value: values[i-1] }
+ [1, 2].map do |i|
+ { name: "X#{i}", value: values[i - 1] }
end
end
describe '#to_f' do
context 'when variables are not numbers but have value' do
@@ -61,21 +63,21 @@
end
shared_examples 'a operator that has two terms and knows how to return a string out of it' do |command, arguments|
let(:values) { arguments[:values] }
- include_context 'variables are initialized', arguments[command], *%w(string_expected numeric_string_expected partial_string_expected)
+ include_context 'when variables are initialized', arguments[command], 'string_expected', 'numeric_string_expected', 'partial_string_expected'
describe "##{command}" do
let(:variables) do
- [ 1, 2 ].map do |i|
- { name: "X#{i}", value: values[i-1] }
+ [1, 2].map do |i|
+ { name: "X#{i}", value: values[i - 1] }
end
end
context 'when variables have no value' do
let(:variables) do
- [ 1,2 ].map { |i| "X#{i}" }
+ [1, 2].map { |i| "X#{i}" }
end
it 'returns a text format fraction' do
expect(subject.public_send(command)).to eq(string_expected)
end
@@ -107,6 +109,5 @@
expect(subject.public_send(command)).to eq(partial_string_expected)
end
end
end
end
-