Sha256: f9e801190e4d22394c3a5f35d560eb24a1e594b05a3ef65f120adc162102bc5b

Contents?: true

Size: 769 Bytes

Versions: 23

Compression:

Stored size: 769 Bytes

Contents

shared_examples 'a variable method to formated string' do |method, format|
  let(:name) { :delta }
  let(:value) { 10.0 }
  let(:arguments) { { name: name, latex: '\delta', gnu: 'del' } }
  subject { described_class.new(arguments) }

  context "when #{format} is not defined" do
    before { arguments.delete(format) }

    it 'returns name' do
      expect(subject.public_send(method)).to eq('delta')
    end

    context 'when value is defined' do
      before { arguments[:value] = value }

      it 'returns the value' do
        expect(subject.public_send(method)).to eq('10')
      end
    end
  end

  context "when #{format} has been defined" do
    it "returns #{format}" do
      expect(subject.public_send(method)).to eq(arguments[format])
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
danica-2.6.4 spec/support/shared_examples/variable.rb
danica-2.6.3 spec/support/shared_examples/variable.rb
danica-2.6.2 spec/support/shared_examples/variable.rb
danica-2.6.1 spec/support/shared_examples/variable.rb
danica-2.6.0 spec/support/shared_examples/variable.rb
danica-2.5.1 spec/support/shared_examples/variable.rb
danica-2.5.0 spec/support/shared_examples/variable.rb
danica-2.4.4 spec/support/shared_examples/variable.rb
danica-2.4.3 spec/support/shared_examples/variable.rb
danica-2.4.2 spec/support/shared_examples/variable.rb
danica-2.4.1 spec/support/shared_examples/variable.rb
danica-2.4.0 spec/support/shared_examples/variable.rb
danica-2.3.1 spec/support/shared_examples/variable.rb
danica-2.3.0 spec/support/shared_examples/variable.rb
danica-2.2.1 spec/support/shared_examples/variable.rb
danica-2.2.0 spec/support/shared_examples/variable.rb
danica-2.1.1 spec/support/shared_examples/variable.rb
danica-2.1.0 spec/support/shared_examples/variable.rb
danica-2.0.6 spec/support/shared_examples/variable.rb
danica-2.0.5 spec/support/shared_examples/variable.rb