Sha256: 204fc9878ac0034d510f06baece3f2091b142ff974df30c41e053a5064befc2c

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

shared_examples_for "renaming" do

  describe "an attribute in the api template" do

    before(:each) do
      @response = @luke.as_api_response(:rename_last_name)
    end

    it "returns a hash" do
      @response.should be_kind_of(Hash)
    end

    it "returns the correct number of fields" do
      @response.should have(1).keys
    end

    it "returns all specified fields" do
      @response.keys.should include(:family_name)
    end

    it "returns the correct values for the specified fields" do
      @response.values.should include(@luke.last_name)
    end

  end

  describe "the node/key of a method in the api template" do

    before(:each) do
      @response = @luke.as_api_response(:rename_full_name)
    end

    it "returns a hash" do
      @response.should be_kind_of(Hash)
    end

    it "returns the correct number of fields" do
      @response.should have(1).keys
    end

    it "returns all specified fields" do
      @response.keys.should include(:other_full_name)
    end

    it "returns the correct values for the specified fields" do
      @response.values.should include(@luke.full_name)
    end

  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
acts_as_api-0.4.4 spec/support/model_examples/renaming.rb
acts_as_api-0.4.3 spec/support/model_examples/renaming.rb
acts_as_api_sequel-0.0.1 spec/support/model_examples/renaming.rb
acts_as_api-0.4.2 spec/support/model_examples/renaming.rb
acts_as_api-0.4.1 spec/support/model_examples/renaming.rb
acts_as_api-0.4 spec/support/model_examples/renaming.rb
acts_as_api-0.3.11 spec/support/model_examples/renaming.rb
acts_as_api-0.3.10 spec/support/model_examples/renaming.rb
acts_as_api-0.3.9 spec/support/model_examples/renaming.rb
acts_as_api-0.3.8 spec/support/model_examples/renaming.rb
acts_as_api-0.3.7 spec/support/model_examples/renaming.rb
acts_as_api-0.3.6 spec/support/model_examples/renaming.rb