Sha256: b4c2f85a98b569331d6007f65a4b19599738aa99973248301f6c0f0f59f0263c

Contents?: true

Size: 976 Bytes

Versions: 6

Compression:

Stored size: 976 Bytes

Contents

require_relative '../spec_helper'

describe Ravelry::Needle do
  before do
    @ndl = Ravelry::Needle.new(needle)
    @data = needle
  end

  it 'creates an instance of Needle' do
    expect(@ndl).to be_instance_of(Ravelry::Needle)
  end

  context 'has and sets reader attributes for' do
    it 'hook' do
      expect(@ndl.hook).to eq(@data[:hook])
    end

    it 'us' do
      expect(@ndl.us).to eq(@data[:us])
    end

    it 'metric' do
      expect(@ndl.metric).to eq(@data[:metric])
    end
  end

  context 'class methods' do
    it '#type returns crochet' do
      ndl = { :hook=>"E", :us_steel=>"00", :name=>"US 4  - 3.5 mm",
      :crochet=>true, :metric=>3.5, :knitting=>false, :us=>"4 ",
      :id=>4 }
      needle = Ravelry::Needle.new(ndl)
      expect(needle.type).to eq('crochet')
    end

    it '#us_string' do
      expect(@ndl.us_string).to eq('US 4')
    end

    it '#metric_string' do
      expect(@ndl.metric_string).to eq('3.5 mm')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ravelry-0.2.0 spec/ravelry/needle_spec.rb
ravelry-0.1.0 spec/ravelry/needle_spec.rb
ravelry-0.0.9 spec/ravelry/needle_spec.rb
ravelry-0.0.8 spec/ravelry/needle_spec.rb
ravelry-0.0.7 spec/ravelry/needle_spec.rb
ravelry-0.0.6 spec/ravelry/needle_spec.rb