Sha256: 449f4c9a8f3fba14f6616df5288d8501ea485eb51d9adcd0f6c09ef08662955f

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe Belajar::TestExample do

    it { is_expected.to respond_to :description }
    it { is_expected.to respond_to :status }
    it { is_expected.to respond_to :message }

  context "when passed:" do
    let(:description) { test_passed_json_parsed[:examples].first[:description] }
    let(:status) { test_passed_json_parsed[:examples].first[:status] }

    subject { Belajar::TestExample.new(description: description, status: status) }

    it "has the prescribed description" do
      expect(subject.description).to eq description
    end

    it "has the prescribed status" do
      expect(subject.status).to eq status
    end

    it "has the prescribed message" do
      expect(subject.message).to eq example_passed_message
    end
  end

  context "when failed:" do
    let(:description) { test_failed_json_parsed[:examples].first[:description] }
    let(:status) { test_failed_json_parsed[:examples].first[:status] }
    let(:message) { test_failed_json_parsed[:examples].first[:exception][:message] }

    subject do
      Belajar::TestExample.new(
        description: description,
        status: status,
        message: message
      )
    end

    it "has the prescribed description" do
      expect(subject.description).to eq description
    end

    it "has the prescribed status" do
      expect(subject.status).to eq status
    end

    it "has the prescribed message" do
      expect(subject.message).to eq message
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
belajar-0.1.1 spec/belajar/test_example_spec.rb