Sha256: 7d8cffe7b322ed7c30e94dd3a102f60bda13d23e6a57f999836c4c485d9b5340

Contents?: true

Size: 873 Bytes

Versions: 2

Compression:

Stored size: 873 Bytes

Contents

shared_examples_for "a taggable class" do
  before(:each) do
    (@tags = []).tap do 
      @tags << Highrise::Tag.new(:name => "cliente", :id => 414578)
      @tags << Highrise::Tag.new(:name => "ged", :id => 414580)
      @tags << Highrise::Tag.new(:name => "iepc", :id => 414579)
    end
  end

  it { subject.class.included_modules.should include(Highrise::Taggable) }

  it "#tags" do
    subject.should_receive(:get).with(:tags).and_return(@tags)
    subject.tags.should == @tags
  end
  
  it "#tag!(tag_name)" do
    subject.should_receive(:post).with(:tags, :name => "client" ).and_return(true)
    subject.tag!("client").should be_true
  end
  
  it "#untag!(tag_name)" do
    subject.should_receive(:get).with(:tags).and_return(@tags)
    subject.should_receive(:delete).with("tags/414578").and_return(true)
    subject.untag!("cliente").should be_true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
highrise-3.2.1 spec/highrise/taggable_behavior.rb
highrise-3.1.6 spec/highrise/taggable_behavior.rb