Sha256: 6c3369b8ded2e9c7c5fdac3920f87eca992ca366506935a8150db6f5d66901df

Contents?: true

Size: 975 Bytes

Versions: 14

Compression:

Stored size: 975 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe GamesController, controller: true do
  describe 'readme' do
    describe 'POST create' do
      it 'create game' do
        post '/publishers.json', params: {
          publisher: {
            name: 'Nintendo'
          }
        }

        publisher = JSON.parse(response.body)
        expect(publisher)
          .to eq({
                   'id' => publisher['id'],
                   'name' => 'Nintendo'
                 })

        publisher = Publisher.last
        post "/publishers/#{publisher['id']}/games.json", params: {
          game: {
            name: 'Pokemon'
          }
        }

        game = Game.last

        expect(JSON.parse(response.body))
          .to eq({
                   'id' => game.id,
                   'name' => 'Pokemon',
                   'publisher' => {
                     'name' => 'Nintendo'
                   }
                 })
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
azeroth-1.0.0 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.10.1 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.10.0 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.9.0 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.8.2 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.8.1 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.8.0 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.7.4 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.7.3 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.7.2 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.7.1 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.7.0 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.6.5 spec/integration/readme/controllers/games_controller_spec.rb
azeroth-0.6.4 spec/integration/readme/controllers/games_controller_spec.rb