Sha256: 70e608b407af382b51021b299ef1c22eb2e75f2785de6b026b875bede65c3dd2

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

describe Wego::Result do
  describe ".find" do
    context "when no hotel specified" do
      it "returns search results" do
        search_id = 716_073_46
        stub_search_results_api(search_id)
        results = Wego::Result.find search_id

        expect(results.count).to eq(5)
        expect(results.hotels.first.name).to eq("Parkroyal Darling Harbour")
      end
    end

    context "when hotel_id specified" do
      it "returns one specific hotels" do
        search_id = 716_073_46
        hotel_id = 273_451
        stub_search_result_api(search_id: search_id, hotel_id: hotel_id)
        result = Wego::Result.find search_id, hotel_id: hotel_id

        expect(result.hotel.name).to eq("InterContinental Sydney")
      end
    end

    context "when customized option provided" do
      it "filters the search results" do
        search_id = 716_073_46
        options = { lang: "en", sort: "popularity" }
        stub_search_results_api(search_id, options)
        results = Wego::Result.find search_id, options

        expect(results.hotels.first.name).to eq("Parkroyal Darling Harbour")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wego-0.2.2 spec/wego/result_spec.rb
wego-0.2.1 spec/wego/result_spec.rb
wego-0.2.0 spec/wego/result_spec.rb
wego-0.1.5 spec/wego/result_spec.rb
wego-0.1.4 spec/wego/result_spec.rb
wego-0.1.3 spec/wego/result_spec.rb
wego-0.1.2 spec/wego/result_spec.rb