sham 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,5 +3,6 @@ pkg/*
3
3
  *.gem
4
4
  *.swp
5
5
  .bundle
6
+ .rvmrc
6
7
  Gemfile.lock
7
8
  doc
@@ -12,7 +12,8 @@ module Sham
12
12
  end
13
13
  end
14
14
 
15
- def add_options! klass, options = {}, attributes
15
+ def add_options! klass, options, attributes
16
+ options ||= {}
16
17
  attributes.call.each do |key, value|
17
18
  options[key] = parse!(value) unless options.has_key?(key)
18
19
  end
@@ -1,3 +1,3 @@
1
1
  module Sham
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -4,8 +4,8 @@ end
4
4
  Sham.config(Employee) do |c|
5
5
  c.attributes do
6
6
  {
7
- name: "Employee #{Sham.string!}",
8
- email: "#{Sham.string!}@company.com"
7
+ :name => "Employee #{Sham.string!}",
8
+ :email => "#{Sham.string!}@company.com"
9
9
  }
10
10
  end
11
11
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Sham::Base do
4
- let(:base){ Sham::Base.new(User, name: Sham.string!) }
4
+ let(:base){ Sham::Base.new(User, :name => Sham.string!) }
5
5
 
6
6
  it 'should call sham! on the klass' do
7
7
  User.should_receive(:sham!)
@@ -38,7 +38,7 @@ describe Sham::Config do
38
38
 
39
39
  expect {
40
40
  Sham.config(BiggestCompany){ |c| c.empty }
41
- }.to change{ BiggestCompany.respond_to?(:sham_alternate!) }
41
+ }.to change{ BiggestCompany.respond_to?(:sham_alternate!) } \
42
42
  .from(false).to(true)
43
43
  end
44
44
 
@@ -55,7 +55,7 @@ describe Sham::Config do
55
55
 
56
56
  Sham.config(PowerUser){ |c| c.empty }
57
57
 
58
- User.sham_config(:default)
58
+ User.sham_config(:default) \
59
59
  .should_not == PowerUser.sham_config(:default)
60
60
  end
61
61
 
@@ -96,7 +96,7 @@ describe Sham::Config do
96
96
  end
97
97
 
98
98
  it 'should sham alternatives with alternative options' do
99
- User.sham!(:super)[:identifier]
99
+ User.sham!(:super)[:identifier] \
100
100
  .should_not == User.sham![:identifier]
101
101
  end
102
102
 
@@ -109,10 +109,10 @@ describe Sham::Config do
109
109
  it 'should allow nested shams to be overwritten' do
110
110
  profile = Profile.new
111
111
 
112
- User.sham!(:with_profile, profile: profile)[:profile]
112
+ User.sham!(:with_profile, :profile => profile)[:profile] \
113
113
  .should == profile
114
114
 
115
- User.sham!(:with_profile)[:profile]
115
+ User.sham!(:with_profile)[:profile] \
116
116
  .should_not == profile
117
117
  end
118
118
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Sham::Util do
4
4
  context '#extract_options!' do
5
- let(:ary){ [1, 2, 3, 4, opt: 'arg', opt2: 'arg'] }
5
+ let(:ary){ [1, 2, 3, 4, {:opt => 'arg', :opt2 => 'arg'}] }
6
6
 
7
7
  it 'should alter the original array' do
8
8
  expect {
@@ -22,16 +22,16 @@ end
22
22
  Sham.config(User) do |c|
23
23
  c.attributes do
24
24
  {
25
- name: Sham.string!,
26
- email: "#{Sham.string!}@gmail.com",
27
- identifier: 100
25
+ :name => Sham.string!,
26
+ :email => "#{Sham.string!}@gmail.com",
27
+ :identifier => 100
28
28
  }
29
29
  end
30
30
  end
31
31
 
32
32
  Sham.config(User, :super) do |c|
33
33
  c.attributes do
34
- { identifier: 200 }
34
+ { :identifier => 200 }
35
35
  end
36
36
  end
37
37
 
@@ -39,7 +39,7 @@ class Profile < User; end
39
39
 
40
40
  Sham.config(User, :with_profile) do |c|
41
41
  c.attributes do
42
- { profile: Sham::Base.new(Profile) }
42
+ { :profile => Sham::Base.new(Profile) }
43
43
  end
44
44
  end
45
45
  Sham.config(Profile){ |c| c.empty }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sham
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-03 00:00:00.000000000Z
12
+ date: 2011-11-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70284343539020 !ruby/object:Gem::Requirement
16
+ requirement: &70137106338160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70284343539020
24
+ version_requirements: *70137106338160
25
25
  description: Lightweight flexible factories for Ruby and Rails testing.
26
26
  email:
27
27
  - pan.thomakos@gmail.com
@@ -75,7 +75,7 @@ rubyforge_project: sham
75
75
  rubygems_version: 1.8.6
76
76
  signing_key:
77
77
  specification_version: 3
78
- summary: sham-1.0.1
78
+ summary: sham-1.0.2
79
79
  test_files:
80
80
  - spec/root/sham/employee.rb
81
81
  - spec/sham/base_spec.rb