Sha256: ea4e320793615132d4eb2f47858baba22bbb2d0fd96a1a91bf7ce7421303a271

Contents?: true

Size: 1.69 KB

Versions: 50

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

describe WithExpectations do
  let(:exercise) { build(:exercise) }

  context 'when setting empty list' do
    before { exercise.expectations = [] }

    it { expect(exercise.expectations).to eq [] }
  end

  context 'when setting empty yaml' do
    before { exercise.expectations_yaml = [].to_yaml }

    it { expect(exercise.expectations).to eq [] }
  end

  context 'when no expectations' do
    it { expect(exercise.expectations).to eq [] }
  end

  context 'when setting non empty symbolized list' do
    before { exercise.expectations = [{binding: 'foo', inspection: 'HasBinding'}] }

    it { expect(exercise.expectations).to eq [{'binding' => 'foo', 'inspection' => 'HasBinding'}] }
  end

  context 'when setting non empty stringified list' do
    before { exercise.expectations = [{'binding' => 'foo', 'inspection' => 'HasBinding'}] }

    it { expect(exercise.expectations).to eq [{'binding' => 'foo', 'inspection' => 'HasBinding'}] }
  end

  context 'when setting non empty yaml' do
    before { exercise.expectations_yaml = [{'binding' => 'foo', 'inspection' => 'HasBinding'}].to_yaml }

    it { expect(exercise.expectations).to eq [{'binding' => 'foo', 'inspection' => 'HasBinding'}] }
  end

  context 'when the guide has expectations' do
    let(:guide) { create(:guide) }

    before do
      exercise.language = guide.language
      exercise.expectations = [{binding: 'foo', inspection: 'HasBinding'}]
      exercise.guide = guide

      guide.expectations = [{binding: 'bar', inspection: 'HasBinding'}]
    end

    it {
      expect(exercise.expectations)
      .to eq [{'binding' => 'foo', 'inspection' => 'HasBinding'}, {'binding' => 'bar', 'inspection' => 'HasBinding'}]
    }
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
mumuki-laboratory-6.1.5 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.0.4 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.1.4 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.1.3 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.0.3 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.1.2 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.1.1 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.1.0 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.0.2 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.0.1 spec/models/with_expectations_spec.rb
mumuki-laboratory-6.0.0 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.13.0 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.12.1 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.12.0 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.11.0 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.10.4 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.10.3 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.10.2 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.10.1 spec/models/with_expectations_spec.rb
mumuki-laboratory-5.10.0 spec/models/with_expectations_spec.rb