spec/support/shared_examples/operator/chained.rb in danica-2.4.2 vs spec/support/shared_examples/operator/chained.rb in danica-2.4.3

- old
+ new

@@ -36,30 +36,30 @@ end end end shared_examples 'a operator that knows how to write to tex' do |arguments| - it_behaves_like 'a operator that knows how to write to a string', :to_tex, arguments + it_behaves_like 'a operator that knows how to write to a string', :tex, arguments end shared_examples 'a operator that knows how to write to gnu' do |arguments| - it_behaves_like 'a operator that knows how to write to a string', :to_gnu, arguments + it_behaves_like 'a operator that knows how to write to a string', :gnu, arguments end -shared_examples 'a operator that knows how to write to a string' do |command, arguments| +shared_examples 'a operator that knows how to write to a string' do |format, arguments| let(:numeric_variables) { arguments[:numeric_variables] } - include_context 'variables are initialized', arguments[command], *%w(integer_expected string_expected float_expected) + include_context 'variables are initialized', arguments[format], *%w(integer_expected string_expected float_expected) subject { described_class.new(*variables) } - describe "#{command}" do + describe "#to(#{format})" do let(:variables) do (1..4).map { |i| "X#{i}" } end context 'when variables have no value' do it 'outputs a text format' do - expect(subject.public_send(command)).to eq(string_expected) + expect(subject.to(format)).to eq(string_expected) end end context 'when some variables have values' do let(:numeric_variables_index) { 1 } @@ -68,18 +68,18 @@ subject.variables[i].value = numeric_variables[i] end end it 'outputs a latex format with colapsed numbers' do - expect(subject.public_send(command)).to eq(integer_expected) + expect(subject.to(format)).to eq(integer_expected) end context 'when numeric variables calculated is a float value' do let(:numeric_variables_index) { 2 } it 'outputs a text format with colapsed numbers' do - expect(subject.public_send(command)).to eq(float_expected) + expect(subject.to(format)).to eq(float_expected) end end end context 'when some variables are numbers' do @@ -89,17 +89,17 @@ variables[i] = numeric_variables[i] end end it 'outputs a text format of numbers' do - expect(subject.public_send(command)).to eq(integer_expected) + expect(subject.to(format)).to eq(integer_expected) end context 'when numeric variables are a float value' do let(:numeric_variables_index) { 2 } it 'outputs a text format of numbers' do - expect(subject.public_send(command)).to eq(float_expected) + expect(subject.to(format)).to eq(float_expected) end end end end end