morse_spec_helpers 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88b57506018eb9002bb48f0b2ec1b77ccda103fc
|
4
|
+
data.tar.gz: 12d8d41ef51d630133b373e5e4265ac20119862c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c05df2972145660e07a83e47c77eedf3062002fb8c6674876512a949211f9b569692397d750d61519316dac46ba33da2147701f5536171ebabcedf32906f6fdd
|
7
|
+
data.tar.gz: 125de5a90c7117a41e8892b2a41ef45e20a83fdfab56363fcf2a4806f36134b4dc479ae2fbab8962470a112f61869701dfd3c795f2fd28d5acefc1b7367d80ab
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class SupportGenerator < Rails::Generators::Base
|
2
|
+
source_root(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
def setup
|
4
|
+
support_dir="#{Rails.root}/spec/support"
|
5
|
+
image_dir="#{support_dir}/spec/support/images"
|
6
|
+
Dir.mkdir(support_dir) unless Dir.exist?(support_dir)
|
7
|
+
Dir.mkdir(image_dir) unless Dir.exist?(image_dir)
|
8
|
+
copy_file '../support/project_helpers.rb'."#{support_dir}/project/helpers.rb"
|
9
|
+
copy_file '../support/images/placeholder.png'."#{image_dir}/placeholder.png"
|
10
|
+
end
|
11
|
+
end
|
data/lib/morse_spec_helpers.rb
CHANGED
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
def setup_factories
|
2
|
+
#Commenting out the dynamic bit, as it's too slow
|
3
|
+
#filenames=Dir.new("#{Rails.root}/app/models").entries.select{|e| e.match(/.rb$/)}
|
4
|
+
#modelnames=filenames.map{|fn| fn.gsub(/.rb$/,'').camelize.constantize}
|
5
|
+
modelnames=[
|
6
|
+
Offer,
|
7
|
+
Postcode,
|
8
|
+
Search
|
9
|
+
]
|
10
|
+
modelnames.each do |thing|
|
11
|
+
string=thing.to_s.underscore
|
12
|
+
symbol=string.to_sym
|
13
|
+
symbol_none="#{string.pluralize}_none".to_sym
|
14
|
+
symbol_none_alt="no_#{string.pluralize}".to_sym
|
15
|
+
symbol_some="#{string.pluralize}_some".to_sym
|
16
|
+
symbol_some_alt="some_#{string.pluralize}".to_sym
|
17
|
+
let(symbol){FactoryGirl.create symbol}
|
18
|
+
let(symbol_none){thing.where(id: [0])}
|
19
|
+
let(symbol_none_alt){thing.where(id: [0])}
|
20
|
+
let(symbol_some){thing.where(id: eval(string).id)}
|
21
|
+
let(symbol_some_alt){thing.where(id: eval(string).id)}
|
22
|
+
let("params_new_#{string}".to_sym){ {symbol => {id: 1}} }
|
23
|
+
let("params_full_#{string}".to_sym){ {id:1, symbol => {id: 1}} }
|
24
|
+
end
|
25
|
+
let(:params_id){ {id: 1} }
|
26
|
+
end
|
27
|
+
|
28
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morse_spec_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terry S
|
@@ -50,8 +50,11 @@ files:
|
|
50
50
|
- LICENSE.txt
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
|
+
- lib/generators/support_generator.rb
|
53
54
|
- lib/morse_spec_helpers.rb
|
54
55
|
- lib/morse_spec_helpers/version.rb
|
56
|
+
- lib/support/images/placeholder.png
|
57
|
+
- lib/support/project_helpers.rb
|
55
58
|
- morse_spec_helpers.gemspec
|
56
59
|
homepage: ''
|
57
60
|
licenses:
|