Sha256: 23776012dd64a6fb5fe58a370f963f2e20dbd0b994b83b4bb9cd7f93ae55eb04

Contents?: true

Size: 538 Bytes

Versions: 12

Compression:

Stored size: 538 Bytes

Contents

require "spec_helper"

RSpec.describe Code do
  subject { described_class.evaluate(input).to_s }

  [
    %w[(1..2).any?(&:even?) true],
    %w[(1..1).any?(&:even?) false],
    %w[(3..3).any?(&:even?) false],
    %w[(2..5).any?(&:even?) true],
    ["(2..5).any? { |n| n.even? }", "true"],
    ["(2..5).select { |i| i.even? }.any? { |n| n.even? }", "true"],
  ].each do |(input, expected)|
    context input.inspect do
      let(:input) { input }

      it "succeeds" do
        expect(subject).to eq(expected)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
template-ruby-0.4.0 spec/call_spec.rb
code-ruby-0.4.0 spec/call_spec.rb
template-ruby-0.3.1 spec/call_spec.rb
code-ruby-0.3.1 spec/call_spec.rb
template-ruby-0.3.0 spec/call_spec.rb
code-ruby-0.3.0 spec/call_spec.rb
code-ruby-0.2.4 spec/call_spec.rb
template-ruby-0.2.4 spec/call_spec.rb
template-ruby-0.2.3 spec/call_spec.rb
template-ruby-0.2.2 spec/call_spec.rb
template-ruby-0.2.1 spec/call_spec.rb
template-ruby-0.2.0 spec/call_spec.rb