Sha256: 8760924e973a7c80c1e7cb1013bee84e91bc66fbececb019c93da49f045cd70d

Contents?: true

Size: 684 Bytes

Versions: 14

Compression:

Stored size: 684 Bytes

Contents

require 'spec_helper'

describe MessagesController, type: :controller do
  describe '#create' do
    before :each do
      data = {
        data: {
          name: 'John',
          city: 'Prague',
        },
        scope: {},
      }

      post(:create, javascriptize(data))
    end

    it 'responds consistently to js' do
      expect(rubize(response)).to eq(
        success: true,
        id: '1',
        scoped_records: all_records(Message),
      )
    end

    it 'creates the record' do
      message = Message.find(1)
      message_attributes = message.attributes.to_options
      expect(message_attributes.slice(:id, :name)).to eq(id: 1, name: 'John')
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
databound-3.1.3 spec/controllers/on_the_fly_spec.rb
databound-3.1.2 spec/controllers/on_the_fly_spec.rb
databound-3.1.1 spec/controllers/on_the_fly_spec.rb
databound-3.1.0 spec/controllers/on_the_fly_spec.rb
databound-3.0.3 spec/controllers/on_the_fly_spec.rb
databound-3.0.2 spec/controllers/on_the_fly_spec.rb
databound-3.0.1 spec/controllers/on_the_fly_spec.rb
databound-3.0.0 spec/controllers/on_the_fly_spec.rb
databound-2.0.1 spec/controllers/on_the_fly_spec.rb
databound-2.0.0 spec/controllers/on_the_fly_spec.rb
databound-1.1.0 spec/controllers/on_the_fly_spec.rb
databound-1.0.2 spec/controllers/on_the_fly_spec.rb
databound-1.0.1 spec/controllers/on_the_fly_spec.rb
databound-1.0.0 spec/controllers/on_the_fly_spec.rb