Sha256: cccd7377a729986c9b6d3b1561e8b785935a28fe36193acf713991950c63a2f7

Contents?: true

Size: 746 Bytes

Versions: 3

Compression:

Stored size: 746 Bytes

Contents

FancySpec describe: Symbol with: {
  it: "is usable like a block for Enumerable methods" with: 'call: when: {
    [1,2,3,4,5] map: 'squared .
      is: [1,4,9,16,25]

    ["hello", "world"] map: 'upcase .
      is: ["HELLO", "WORLD"]

    [1,2,3,4,5] select: 'even? .
      is: [2,4]
  }

  it: "evaluates itself within the current scope" with: 'eval when: {
    x = 10
    'x eval is: x
  }

  it: "sends itself to the sender in its context" with: 'call when: {
    def foo {
      "foo"
    }
    def bar {
      "bar"
    }
    x = false
    if: x then: 'foo else: 'bar . is: "bar"
    x = true
    if: x then: 'foo else: 'bar . is: "foo"
  }

  it: "returns self" with: 'to_sym when: {
    'foo to_sym is: 'foo
    'bar to_sym is: 'bar
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fancy-0.8.0 tests/symbol.fy
fancy-0.7.0 tests/symbol.fy
fancy-0.6.0 tests/symbol.fy