Sha256: f73c07b93019e5c9f6374416f02407878a8ab86e9340acf130c3a8cbf80f01f2

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe SharedEngine::PlainObjectsController do
  include ApiTestHelpers

  before(:each) do
    class SharedEngine::PlainObjectsController
      include SimpleFixtures
    end
  end

  describe 'get all users as a an array of plain objects, autodetecting the root node name' do

    before(:each) do
      get :index, :format => 'json', :api_template => :name_only
    end

    it "should have a root node named users" do
      response_body_json.should have_key("plain_objects")
    end

    it "should contain all users" do
      response_body_json["plain_objects"].should be_a(Array)
    end

    it "should contain the specified attributes" do
      response_body_json["plain_objects"].first.should have_key("first_name")
      response_body_json["plain_objects"].first.should have_key("last_name")
    end

    it "should contain the specified values" do
      response_body_json["plain_objects"].first["first_name"].should eql("Han")
      response_body_json["plain_objects"].first["last_name"].should eql("Solo")
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
acts_as_api_sequel-0.0.1 spec/controllers/plain_objects_controller_spec.rb
acts_as_api-0.4.2 spec/controllers/plain_objects_controller_spec.rb