Sha256: 2a1ffd71032ec303a9279a58ac61f5b253b8fe736e557f42bdfb03d18857f073

Contents?: true

Size: 927 Bytes

Versions: 7

Compression:

Stored size: 927 Bytes

Contents

describe JsonTestData::String do
  describe ".create" do
    context "normal" do
      let(:object) do
        {
          type: "string"
        }
      end

      it "returns a string" do
        expect(described_class.create(object)).to be_a String
      end

      it "returns a single character" do
        expect(described_class.create(object).length).to eq 1
      end
    end

    context "with maximum length" do
      let(:object) do
        {
          type: "string",
          maxLength: 2
        }
      end

      it "returns a string 2 characters long" do
        expect(described_class.create(object).length).to eq 2
      end
    end

    context "with minimum length" do
      let(:object) do
        {
          type: "string",
          minLength: 8
        }
      end

      it "returns an 8-character string" do
        expect(described_class.create(object).length).to eq 8
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
json_test_data-0.7.0 spec/json_test_data/data_structures/string_spec.rb
json_test_data-0.6.0 spec/json_test_data/data_structures/string_spec.rb
json_test_data-0.5.1 spec/json_test_data/data_structures/string_spec.rb
json_test_data-0.5.0 spec/json_test_data/data_structures/string_spec.rb
json_test_data-0.4.0 spec/json_test_data/data_structures/string_spec.rb
json_test_data-0.4.0.beta spec/json_test_data/data_structures/string_spec.rb
json_test_data-0.3.0.beta spec/json_test_data/data_structures/string_spec.rb