require 'spec_helper'
module WeatherReporter
  module HTTPService
    RSpec.describe Request do
      require 'pry'

      let(:data) {{city: "kathmandu"}}
      let(:config) {WeatherReporter::Configuration.new }
      let(:request) do
        WeatherReporter::HTTPService::Request.new({city: "kathmandu"}, config)
      end

      describe '.initialize' do
        it 'set data of the object from user' do
          expect(request.data).to(eq(data))
        end

        it 'carries valid configuration' do
          expect(request.configuration).to(eq(config.read_file))
        end
      end

      describe '#report' do
        it 'gets reponce form the API call' do
          expect(request.report.class).to(eq(HTTParty::Response))
        end
      end

    end
  end
end

require 'spec_helper'
module WeatherReporter
  module HTTPService
    RSpec.describe Request do
      require 'pry'

      let(:data) {{city: "kathmandu"}}
      let(:config) {WeatherReporter::Configuration.new }
      let(:request) do
        WeatherReporter::HTTPService::Request.new({city: "kathmandu"}, config)
      end

      describe '.initialize' do
        it 'set data of the object from user' do
          expect(request.data).to(eq(data))
        end

        it 'carries valid configuration' do
          expect(request.configuration).to(eq(config.read_file))
        end
      end

      describe '#report' do
        it 'gets reponce form the API call' do
          expect(request.report.class).to(eq(HTTParty::Response))
        end

        it 'get data of the given city' do
          json = JSON.parse(File.read("spec/fixtures/weather.json"))
          responce =  JSON.parse(request.report)
          expect(responce['location']['name']).to eq(json['location']['name'])
        end
      end

    end
  end
end

Test case for the correct city it gives weather of city given by users
Test case for the correct city
it gives weather of city given by users
