yockeries 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/yockeries.rb CHANGED
@@ -59,7 +59,8 @@ module Yockeries
59
59
  module Loader
60
60
  def fixture(filename)
61
61
  dir = File.exists?('test') ? 'test' : 'spec'
62
- ::Yockeries::YockHash.new(YAML.load_file("#{dir}/fixtures/#{filename.to_s}.yaml"))
62
+ file = Dir.glob("#{dir}/fixtures/#{filename}.{yaml,yml}").first
63
+ ::Yockeries::YockHash.new(YAML.load_file(file))
63
64
  end
64
65
  end
65
66
  end
@@ -0,0 +1,2 @@
1
+ betsy:
2
+ says: moo
@@ -0,0 +1,2 @@
1
+ albert:
2
+ bananas: 10
@@ -30,4 +30,16 @@ module Yockeries
30
30
  subject.mock_for('user_1').name.must_equal 'robert'
31
31
  end
32
32
  end
33
+
34
+ describe "Yockeries Loader" do
35
+ include ::Yockeries::Loader
36
+
37
+ it 'will load the file with yaml extension' do
38
+ fixture(:monkey).mock_for(:albert).bananas.must_equal 10
39
+ end
40
+
41
+ it 'will load the file with a yml extension' do
42
+ fixture(:cow).mock_for(:betsy).says.must_equal 'moo'
43
+ end
44
+ end
33
45
  end
data/yockeries.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "yockeries"
7
- gem.version = '0.0.1'
7
+ gem.version = '0.0.2'
8
8
  gem.authors = ["Robert Evans"]
9
9
  gem.email = ["robert@codewranglers.org"]
10
10
  gem.description = %q{Use Ruby Fixtures to create mocks or use in place of factories to create objects}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yockeries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-04 00:00:00.000000000 Z
12
+ date: 2012-10-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Use Ruby Fixtures to create mocks or use in place of factories to create
15
15
  objects
@@ -25,6 +25,8 @@ files:
25
25
  - README.rdoc
26
26
  - Rakefile
27
27
  - lib/yockeries.rb
28
+ - test/fixtures/cow.yml
29
+ - test/fixtures/monkey.yaml
28
30
  - test/yockeries_test.rb
29
31
  - yockeries.gemspec
30
32
  homepage: ''
@@ -53,4 +55,6 @@ specification_version: 3
53
55
  summary: Use Ruby Fixtures to create mocks or use in place of factories to create
54
56
  objects
55
57
  test_files:
58
+ - test/fixtures/cow.yml
59
+ - test/fixtures/monkey.yaml
56
60
  - test/yockeries_test.rb