superdupe 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/README.markdown +10 -0
  2. data/lib/superdupe/active_resource_extensions.rb +161 -0
  3. data/lib/superdupe/attribute_template.rb +71 -0
  4. data/lib/superdupe/cucumber_hooks.rb +16 -0
  5. data/lib/superdupe/custom_mocks.rb +116 -0
  6. data/lib/superdupe/database.rb +69 -0
  7. data/lib/superdupe/dupe.rb +534 -0
  8. data/lib/superdupe/hash_pruner.rb +37 -0
  9. data/lib/superdupe/log.rb +38 -0
  10. data/lib/superdupe/mock.rb +127 -0
  11. data/lib/superdupe/model.rb +59 -0
  12. data/lib/superdupe/network.rb +56 -0
  13. data/lib/superdupe/record.rb +42 -0
  14. data/lib/superdupe/rest_validation.rb +16 -0
  15. data/lib/superdupe/schema.rb +52 -0
  16. data/lib/superdupe/sequence.rb +20 -0
  17. data/lib/superdupe/singular_plural_detection.rb +9 -0
  18. data/lib/superdupe/string.rb +7 -0
  19. data/lib/superdupe/symbol.rb +3 -0
  20. data/lib/superdupe.rb +20 -0
  21. data/rails_generators/dupe/dupe_generator.rb +20 -0
  22. data/rails_generators/dupe/templates/custom_mocks.rb +4 -0
  23. data/rails_generators/dupe/templates/definitions.rb +9 -0
  24. data/rails_generators/dupe/templates/load_dupe.rb +9 -0
  25. data/spec/lib_specs/active_resource_extensions_spec.rb +141 -0
  26. data/spec/lib_specs/attribute_template_spec.rb +173 -0
  27. data/spec/lib_specs/database_spec.rb +163 -0
  28. data/spec/lib_specs/dupe_spec.rb +522 -0
  29. data/spec/lib_specs/hash_pruner_spec.rb +73 -0
  30. data/spec/lib_specs/log_spec.rb +78 -0
  31. data/spec/lib_specs/logged_request_spec.rb +22 -0
  32. data/spec/lib_specs/mock_definitions_spec.rb +58 -0
  33. data/spec/lib_specs/mock_spec.rb +194 -0
  34. data/spec/lib_specs/model_spec.rb +95 -0
  35. data/spec/lib_specs/network_spec.rb +130 -0
  36. data/spec/lib_specs/record_spec.rb +70 -0
  37. data/spec/lib_specs/rest_validation_spec.rb +17 -0
  38. data/spec/lib_specs/schema_spec.rb +109 -0
  39. data/spec/lib_specs/sequence_spec.rb +39 -0
  40. data/spec/lib_specs/string_spec.rb +31 -0
  41. data/spec/lib_specs/symbol_spec.rb +17 -0
  42. data/spec/spec_helper.rb +8 -0
  43. metadata +142 -0
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Sequence do
4
+ describe "new" do
5
+ it "should intialize the current value to whatever is passed in (or 1 by default)" do
6
+ Sequence.new.current_value.should == 1
7
+ Sequence.new(500).current_value.should == 500
8
+ end
9
+
10
+ it "should accept a block that takes a single parameter" do
11
+ proc {Sequence.new 1, proc {}}.should raise_error(ArgumentError, "Your block must accept a single parameter")
12
+ proc {Sequence.new 1, proc {|n| n}}.should_not raise_error
13
+ proc {Sequence.new 1, proc {|n,m| n}}.should raise_error(ArgumentError, "Your block must accept a single parameter")
14
+ s = Sequence.new 1, proc {|n| "email-#{n}@address.com"}
15
+ s.current_value.should == 1
16
+ end
17
+ end
18
+
19
+ describe "next" do
20
+ it "should return the next value in the sequence, then increment the current value" do
21
+ s = Sequence.new
22
+ s.next.should == 1
23
+ s.current_value.should == 2
24
+ s.next.should == 2
25
+ s.current_value.should == 3
26
+
27
+ s = Sequence.new(500)
28
+ s.next.should == 500
29
+ s.current_value.should == 501
30
+ s.next.should == 501
31
+ s.current_value.should == 502
32
+
33
+ s = Sequence.new 1, proc {|n| "email-#{n}@address.com"}
34
+ s.next.should == "email-1@address.com"
35
+ s.next.should == "email-2@address.com"
36
+ s.current_value.should == 3
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe String do
4
+ describe "plural?" do
5
+ it "should report plural symbols as plural" do
6
+ 'apples'.plural?.should == true
7
+ 'apple'.plural?.should == false
8
+ end
9
+ end
10
+
11
+ describe "singular?" do
12
+ it "should report singular items as singular" do
13
+ 'apples'.singular?.should == false
14
+ 'apple'.singular?.should == true
15
+ end
16
+ end
17
+
18
+ describe "indent" do
19
+ it "should default the indentional level to 2 spaces" do
20
+ 'apples'.indent.should == " apples"
21
+ end
22
+
23
+ it "should accept an indentional level" do
24
+ 'apples'.indent(4).should == " apples"
25
+ end
26
+
27
+ it "should indent each line of the string" do
28
+ "apples\noranges".indent(2).should == " apples\n oranges"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Symbol do
4
+ describe "plural?" do
5
+ it "should report plural symbols as plural" do
6
+ :apples.plural?.should == true
7
+ :apple.plural?.should == false
8
+ end
9
+ end
10
+
11
+ describe "singular?" do
12
+ it "should report singular items as singular" do
13
+ :apples.singular?.should == false
14
+ :apple.singular?.should == true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift './lib'
2
+ require 'rubygems'
3
+ gem 'activeresource'
4
+ gem 'rspec'
5
+ gem 'cucumber'
6
+ require 'cucumber'
7
+ require 'active_resource'
8
+ require 'dupe'
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: superdupe
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
+ platform: ruby
12
+ authors:
13
+ - Marco Ribi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-02 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activeresource
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 3
34
+ version: 2.3.3
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: |-
38
+ SuperDupe is a fork of the originally Dupe and rides on top of ActiveResource to allow you to cuke the client side of
39
+ a service-oriented app without having to worry about whether or not the service is live or available while cuking.
40
+ email: marco.ribi@screenconcept.ch
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files:
46
+ - README.markdown
47
+ files:
48
+ - README.markdown
49
+ - lib/superdupe.rb
50
+ - lib/superdupe/active_resource_extensions.rb
51
+ - lib/superdupe/attribute_template.rb
52
+ - lib/superdupe/cucumber_hooks.rb
53
+ - lib/superdupe/custom_mocks.rb
54
+ - lib/superdupe/database.rb
55
+ - lib/superdupe/dupe.rb
56
+ - lib/superdupe/hash_pruner.rb
57
+ - lib/superdupe/log.rb
58
+ - lib/superdupe/mock.rb
59
+ - lib/superdupe/model.rb
60
+ - lib/superdupe/network.rb
61
+ - lib/superdupe/record.rb
62
+ - lib/superdupe/rest_validation.rb
63
+ - lib/superdupe/schema.rb
64
+ - lib/superdupe/sequence.rb
65
+ - lib/superdupe/singular_plural_detection.rb
66
+ - lib/superdupe/string.rb
67
+ - lib/superdupe/symbol.rb
68
+ - rails_generators/dupe/dupe_generator.rb
69
+ - rails_generators/dupe/templates/custom_mocks.rb
70
+ - rails_generators/dupe/templates/definitions.rb
71
+ - rails_generators/dupe/templates/load_dupe.rb
72
+ - spec/lib_specs/active_resource_extensions_spec.rb
73
+ - spec/lib_specs/attribute_template_spec.rb
74
+ - spec/lib_specs/database_spec.rb
75
+ - spec/lib_specs/dupe_spec.rb
76
+ - spec/lib_specs/hash_pruner_spec.rb
77
+ - spec/lib_specs/log_spec.rb
78
+ - spec/lib_specs/logged_request_spec.rb
79
+ - spec/lib_specs/mock_definitions_spec.rb
80
+ - spec/lib_specs/mock_spec.rb
81
+ - spec/lib_specs/model_spec.rb
82
+ - spec/lib_specs/network_spec.rb
83
+ - spec/lib_specs/record_spec.rb
84
+ - spec/lib_specs/rest_validation_spec.rb
85
+ - spec/lib_specs/schema_spec.rb
86
+ - spec/lib_specs/sequence_spec.rb
87
+ - spec/lib_specs/string_spec.rb
88
+ - spec/lib_specs/symbol_spec.rb
89
+ - spec/spec_helper.rb
90
+ has_rdoc: true
91
+ homepage: http://github.com/screenconcept/dupe
92
+ licenses: []
93
+
94
+ post_install_message:
95
+ rdoc_options:
96
+ - --charset=UTF-8
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ requirements: []
118
+
119
+ rubyforge_project:
120
+ rubygems_version: 1.3.7
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: A tool that helps you mock services while cuking.
124
+ test_files:
125
+ - spec/lib_specs/active_resource_extensions_spec.rb
126
+ - spec/lib_specs/attribute_template_spec.rb
127
+ - spec/lib_specs/database_spec.rb
128
+ - spec/lib_specs/dupe_spec.rb
129
+ - spec/lib_specs/hash_pruner_spec.rb
130
+ - spec/lib_specs/log_spec.rb
131
+ - spec/lib_specs/logged_request_spec.rb
132
+ - spec/lib_specs/mock_definitions_spec.rb
133
+ - spec/lib_specs/mock_spec.rb
134
+ - spec/lib_specs/model_spec.rb
135
+ - spec/lib_specs/network_spec.rb
136
+ - spec/lib_specs/record_spec.rb
137
+ - spec/lib_specs/rest_validation_spec.rb
138
+ - spec/lib_specs/schema_spec.rb
139
+ - spec/lib_specs/sequence_spec.rb
140
+ - spec/lib_specs/string_spec.rb
141
+ - spec/lib_specs/symbol_spec.rb
142
+ - spec/spec_helper.rb