Sha256: eeadf9d3f9c56d37082a230f36adfad5d73f012fcc4eda7b6ffded98fd562da0

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

require 'ostruct'
require 'singleton'

module FlickrMocks
  # contains fixtures for various FlickRaw responses. This class is used internally.
  # For stubbing FlickrRaw APIs for your Rspec 2.0 please refer to the
  # FlickrMocks::Stubs class. This is a singleton class. To access the singleton
  # class instance you can call:
  #
  #   Fixtures.instance
  class Fixtures
    include Singleton
    attr_accessor :photos,:interesting_photos,:author_photos,:photo,:photo_details,
                      :photo_sizes,:photo_size,:expected_methods,:empty_photos,
                      :commons_institutions,:commons_institution_photos

    def initialize
      @photos = load_fixture(:photos)
      @interesting_photos = load_fixture(:interesting_photos)
      @author_photos = load_fixture(:author_photos)

      @photo = load_fixture(:photo)
      @photo_details= load_fixture(:photo_details)
      
      @photo_sizes = load_fixture(:photo_sizes)
      @photo_size = load_fixture(:photo_size)

      @commons_institutions = load_fixture(:commons_institutions)
      @commons_institution_photos = load_fixture(:commons_institution_photos)

      @empty_photos = load_fixture(:empty_photos)

      @expected_methods = load_fixture(:expected_methods)
    end

    # returns directory where fixtures are stored.
    def self.repository
      File.expand_path(File.dirname(__FILE__) + '/../../spec/fixtures') + '/'
    end

    private
    def load_fixture(file)
      fname = Fixtures.repository + file.to_s + '.marshal'
      FlickrMocks::Helpers.load fname
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flickrmocks-0.9.2 lib/flickr_mocks/fixtures.rb
flickrmocks-0.9.1 lib/flickr_mocks/fixtures.rb
flickrmocks-0.9.0 lib/flickr_mocks/fixtures.rb