Sha256: 6de1c22ecf1b8b0b9b40020197893b5d8ff63789314fd6e2e5bb68ad127ee4b5

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

shared_examples_for "match" do
  subject do
    described_class.new :mode => :dtmf,
              :confidence     => 1,
              :utterance      => '6',
              :interpretation => 'foo'
  end

  its(:mode)            { should == :dtmf }
  its(:confidence)      { should == 1 }
  its(:utterance)       { should == '6' }
  its(:interpretation)  { should == 'foo' }

  describe "equality" do
    it "should be equal when mode, confidence, utterance and interpretation are the same" do
      expect(described_class.new(:mode => :dtmf, :confidence => 1, :utterance => '6', :interpretation => 'foo')).to eq(described_class.new(:mode => :dtmf, :confidence => 1, :utterance => '6', :interpretation => 'foo'))
    end

    describe "when the mode is different" do
      it "should not be equal" do
        expect(described_class.new(:mode => :dtmf)).not_to eq(described_class.new(:mode => :speech))
      end
    end

    describe "when the confidence is different" do
      it "should not be equal" do
        expect(described_class.new(:confidence => 1)).not_to eq(described_class.new(:confidence => 0))
      end
    end

    describe "when the utterance is different" do
      it "should not be equal" do
        expect(described_class.new(:utterance => '6')).not_to eq(described_class.new(:utterance => 'foo'))
      end
    end

    describe "when the interpretation is different" do
      it "should not be equal" do
        expect(described_class.new(:interpretation => 'foo')).not_to eq(described_class.new(:interpretation => 'bar'))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_speech-3.0.1-java spec/support/match_examples.rb
ruby_speech-3.0.1 spec/support/match_examples.rb
ruby_speech-3.0.0-java spec/support/match_examples.rb
ruby_speech-3.0.0 spec/support/match_examples.rb