Sha256: d1f40ba90db7776ca74b26af9f208a352c1a9541643924f6336b6ca641dc738d

Contents?: true

Size: 553 Bytes

Versions: 4

Compression:

Stored size: 553 Bytes

Contents

require "spec_helper"

describe AngularSprinkles::Element::Input do
  let(:args) { { "key" => value } }

  subject { described_class.new(args) }

  context "when the value is a string" do
    let(:value) { "value" }

    it "does nothing to the value" do
      expect(subject.attributes).to eq({ data: args })
    end
  end

  context "when the value is not a string" do
    let(:value) { double(to_json: 1) }

    it "turns the args hash into a jsonified data hash" do
      expect(subject.attributes).to eq({ data: { "key" => 1 } })
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
angular_sprinkles-0.3.3 spec/angular_sprinkles/element/input_spec.rb
angular_sprinkles-0.3.2 spec/angular_sprinkles/element/input_spec.rb
angular_sprinkles-0.3.1 spec/angular_sprinkles/element/input_spec.rb
angular_sprinkles-0.3.0 spec/angular_sprinkles/element/input_spec.rb