micro_mock 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +10 -0
  2. data/lib/micro_mock/version.rb +1 -1
  3. metadata +1 -1
data/README.md CHANGED
@@ -20,6 +20,9 @@ MyMock = MicroMock.make
20
20
  # add a class attr
21
21
  MyMock.attr(:foo)
22
22
 
23
+ # add a class attr with a default value
24
+ MyMock.attr(:attr_with_default, "Class value")
25
+
23
26
  # stub a class method
24
27
  MyMock.stub(:say_foo) { |arg| "#{foo} #{arg}!" }
25
28
 
@@ -29,13 +32,20 @@ mock = MyMock.new
29
32
  # add an instance attr
30
33
  mock.attr(:bar)
31
34
 
35
+ # add an instance attr with a default value
36
+ mock.attr(:attr_with_default, "Instance value")
37
+
32
38
  # stub some instance methods
33
39
  mock.stub(:say_bar) { |arg| "#{bar} #{arg}!" }
34
40
 
35
41
  # use the mock
42
+ MyMock.attr_with_default # => "Class value"
43
+ MyMock.foo # => nil
36
44
  MyMock.foo = :foo
37
45
  MyMock.say_foo :bar # => "foobar!"
38
46
 
47
+ mock.attr_with_default # => "Instance value"
48
+ mock.bar # => nil
39
49
  mock.bar = :bar
40
50
  mock.say_bar :foo # => "barfoo!"
41
51
  ```
@@ -1,3 +1,3 @@
1
1
  module MicroMock
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: