Sha256: 7cd0cbca6f409e43ef165ee89f33361dae19a8399a14ebc2b3ecc72ba29e0cf5

Contents?: true

Size: 1.09 KB

Versions: 14

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

RSpec.describe "e-BookMobile API", type: :request do

  describe "/authors" do
    let(:route) { "/authors" }

    describe "POST" do
      let(:headers) do
        {
          "Content-Type" => "application/json"
        }
      end

      let(:request_body) do
        {
          "first_name" => "asgaakh",
          "last_name" => "sjdhhgu",
          "year_of_birth" => 3333
        }.to_json
      end

      let(:response_body) do
        {
          "author" => {
            "id" => 1,
            "first_name" => "asgaakh",
            "last_name" => "sjdhhgu",
            "year_of_birth" => 3333
          }
        }.to_json
      end

      let(:output_file) do
        "spec/contract/output/authors_get_response.json"
      end

      it "retrieve a list of authors" do
        get route

        File.open(output_file, "w+") {|file| file.puts JSON.pretty_generate(JSON.parse(response.body)) }

        expect(response.body).to eql response_body
      end

      it "returns status 200" do
        get route
        expect(response.status).to eql 200
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rambo_ruby-0.7.1 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.7.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.6.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.5.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.4.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.3.3 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.3.2 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.3.1 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.3.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.2.3 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.2.2 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.2.1 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.2.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example
rambo_ruby-0.1.0 features/support/examples/rspec/spec_file_with_request_headers.rb.example