Sha256: d41204ab78a0fedc783ba236f13737916bf1b6818121c5897a1f03779ae70f83

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

shared_examples_for "tag mode hash option" do
  let(:default_tag_mode){FlickrMocks::Api.default(:tag_mode)}
  def expected?
    begin
      expected
      true
    rescue
      false
    end
  end
  it "returns supplied value when :tag_mode is all" do
    subject.send(method,options.clone.merge({:tag_mode=>'all'})).should ==
      (expected? ? expected.clone.merge({:tag_mode => 'all'}) : 'all')
  end
  it "returns supplied value when :tag_mode is any" do
    subject.send(method,options.clone.merge({:tag_mode=>'any'})).should ==
      (expected? ? expected.clone.merge({:tag_mode => 'any'}) : 'any')
  end
  it "returns default tag_mode when tag_mode is not specified" do
    subject.send(method,options.clone.merge({})).should ==
      (expected? ? expected.clone.merge({:tag_mode => default_tag_mode}) : default_tag_mode)
  end
  it "returns default tag_mode when tag_mode is nil" do
    subject.send(method,options.clone.merge({:tag_mode => nil})).should ==
      (expected? ? expected.clone.merge({:tag_mode => default_tag_mode}) : default_tag_mode)
  end
  it "should give default tag_mode when junk given for tag_mode" do
    subject.send(method,options.clone.merge(:tag_mode => 'junk')).should ==
      (expected? ? expected.clone.merge({:tag_mode => default_tag_mode}) : default_tag_mode)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flickrmocks-0.9.2 spec/shared_examples/hash_options/tag_mode_hash_option.rb
flickrmocks-0.9.1 spec/shared_examples/hash_options/tag_mode_hash_option.rb
flickrmocks-0.9.0 spec/shared_examples/hash_options/tag_mode_hash_option.rb