sham 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,12 +58,12 @@ Here is an example of testing validations on an ActiveRecord::Base class using S
58
58
  # in spec/models/item_spec.rb
59
59
  describe Item do
60
60
  it "should not allow items with a negative price" do
61
- item = Item.sham :build, :quantity => -1
61
+ item = Item.sham! :build, :quantity => -1
62
62
  item.valid?.should be_false
63
63
  end
64
64
 
65
65
  it "should allow items with a positive quantity" do
66
- item = Item.sham :build, :quantity => 10
66
+ item = Item.sham! :build, :quantity => 10
67
67
  item.valid?.should be_true
68
68
  end
69
69
  end
@@ -102,4 +102,4 @@ You can nest shammed models inside others:
102
102
  The nested shams will automatically be invoked and can be overridden during a sham:
103
103
 
104
104
  LineItem.sham!
105
- LineItem.sham! :item => Item.sham!(:weight => 100)
105
+ LineItem.sham! :item => Item.sham!(:weight => 100)
@@ -39,7 +39,7 @@ module Sham
39
39
 
40
40
  def self.add_options! klass, options = {}, options_string = "options"
41
41
  eval("#{klass}::Sham.#{options_string}").each do |key, value|
42
- options[key] = Sham.parse!(value) unless options.has_key?(key)
42
+ options[key] = self.parse!(value) unless options.has_key?(key)
43
43
  end
44
44
  end
45
45
 
@@ -48,7 +48,7 @@ module Sham
48
48
  klass.class_eval do
49
49
  def self.sham! *args
50
50
  options = (args.extract_options! || {})
51
- Sham.add_options! self.name, options
51
+ ::Sham.add_options! self.name, options
52
52
  klass = (options.delete(:type) || self.name).constantize
53
53
  return klass.create(options) unless args[0] == :build
54
54
  return klass.new(options)
@@ -56,7 +56,7 @@ module Sham
56
56
 
57
57
  def self.sham_alternate! type, *args
58
58
  options = (args.extract_options! || {})
59
- Sham.add_options! self.name, options, "#{type}_options"
59
+ ::Sham.add_options! self.name, options, "#{type}_options"
60
60
  klass = (options.delete(:type) || self.name).constantize
61
61
  return klass.create(options) unless args[0] == :build
62
62
  return klass.new(options)
@@ -1,3 +1,3 @@
1
1
  module Sham
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sham
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 2
7
+ - 3
9
8
  - 0
10
- version: 0.2.0
9
+ version: 0.3.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Pan Thomakos
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-12-05 00:00:00 -08:00
17
+ date: 2010-12-13 00:00:00 -08:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -53,7 +52,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
52
  requirements:
54
53
  - - ">="
55
54
  - !ruby/object:Gem::Version
56
- hash: 3
57
55
  segments:
58
56
  - 0
59
57
  version: "0"
@@ -62,7 +60,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
60
  requirements:
63
61
  - - ">="
64
62
  - !ruby/object:Gem::Version
65
- hash: 3
66
63
  segments:
67
64
  - 0
68
65
  version: "0"
@@ -72,6 +69,6 @@ rubyforge_project: sham
72
69
  rubygems_version: 1.3.7
73
70
  signing_key:
74
71
  specification_version: 3
75
- summary: sham-0.2.0
72
+ summary: sham-0.3.0
76
73
  test_files: []
77
74