Sha256: 2600fbd7f25f7da25a96e1598fb395355e31f6932b0b83ec1d6fe48bf769ba40

Contents?: true

Size: 927 Bytes

Versions: 11

Compression:

Stored size: 927 Bytes

Contents

require 'spec_helper'

describe "What's said in README" do
  let(:input) {
    JSON.parse(<<~JSON)
      [
        {
          "status": "open",
          "body": " Hello world"
        },
        {
          "status": "closed",
          "body": " Foo bar baz"
        }
      ]
    JSON
  }

  let(:lens) {
    Monolens.load_yaml(<<~YML)
    ---
    version: 1.0
    lenses:
    - array.map:
      - object.transform:
          defn:
            status:
            - str.upcase
            body:
            - str.strip
      - object.rename:
          defn:
            body: description
    YML
  }

  let(:expected) {
    JSON.parse(<<~JSON)
      [
        {
          "status": "OPEN",
          "description": "Hello world"
        },
        {
          "status": "CLOSED",
          "description": "Foo bar baz"
        }
      ]
    JSON
  }

  it 'works' do
    expect(lens.call(input)).to eql(expected)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
monolens-0.6.4 spec/test_readme.rb
monolens-0.6.3 spec/test_readme.rb
monolens-0.6.2 spec/test_readme.rb
monolens-0.6.1 spec/test_readme.rb
monolens-0.6.0 spec/test_readme.rb
monolens-0.5.3 spec/test_readme.rb
monolens-0.5.2 spec/test_readme.rb
monolens-0.5.1 spec/test_readme.rb
monolens-0.5.0 spec/test_readme.rb
monolens-0.4.0 spec/test_readme.rb
monolens-0.3.0 spec/test_readme.rb