Sha256: c689b9da269031f5685ec876c2c5f004d730ba3db192b9cfd649e895608138f1

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

require 'spec_helper'

describe Gutentag::Tag do
  describe '#name' do
    before :each do
      Gutentag::TagName.stub :normalise => 'waffles'
    end

    it "normalises the provided name" do
      Gutentag::TagName.should_receive(:normalise).with('Pancakes').
        and_return('waffles')

      Gutentag::Tag.create!(:name => 'Pancakes')
    end

    it "saves the normalised name" do
      Gutentag::Tag.create!(:name => 'Pancakes').name.should == 'waffles'
    end
  end

  describe '#valid?' do
    it "ignores case when enforcing uniqueness" do
      Gutentag::Tag.create! :name => 'pancakes'

      Gutentag::Tag.create(:name => 'Pancakes').should have(1).error_on(:name)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gutentag-0.2.0 spec/models/gutentag/tag_spec.rb