Sha256: c8afb8e41e1b9e265d917eb0366b90d3534f912e8845d72a2e2382c536fc449f

Contents?: true

Size: 1.23 KB

Versions: 28

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe "embeds_one" do
  describe_example "embeds_one/simple" do
    it 'parses embedded item' do
      @root.item.id.should == "2000"
    end
  end

  describe_example "embeds_one/flattened" do
    it "parses flattened key" do
      @root.item.id.should == "2000"
    end
  end

  describe_example "embeds_one/with_class_name" do
    context 'when a different class name is used for embeddable' do
      it 'parses embedded item' do
        @root.item.id.should == "2000"
      end
    end
  end

  describe_example "embeds_one/with_if" do
    context 'when an embeddable has a conditional proc (:if)' do
      context 'and it evaluates to true' do
        it 'parses embedded item' do
          @root_with_item.id.should == "1"
          @root_with_item.item.id.should == "2000"
        end
      end

      context 'and it evaluates to false' do
        it "doesn't parse embedded item" do
          @root_without_item.id.should == "100"
          @root_without_item.item.should_not be
        end
      end
    end
  end

  describe_example "embeds_one/with_start_key" do
    context 'when there is a start key to parse input' do
      it 'parses embedded item' do
        @root.item.id.should == "2000"
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rest_model-0.1.9 spec/integration/embeds_one_spec.rb
rest_model-0.1.8 spec/integration/embeds_one_spec.rb
rest_model-0.1.7 spec/integration/embeds_one_spec.rb
rest_model-0.1.6 spec/integration/embeds_one_spec.rb
rest_model-0.1.5 spec/integration/embeds_one_spec.rb
rest_model-0.1.4 spec/integration/embeds_one_spec.rb
rest_model-0.1.3 spec/integration/embeds_one_spec.rb
rest_model-0.1.2 spec/integration/embeds_one_spec.rb