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: 83f985a4afeaf1e12108fdcbc43947afaa552828
4
- data.tar.gz: 967f7652846cd8c14e9f9c94c42c7af2a16ff7c5
3
+ metadata.gz: 88b57506018eb9002bb48f0b2ec1b77ccda103fc
4
+ data.tar.gz: 12d8d41ef51d630133b373e5e4265ac20119862c
5
5
  SHA512:
6
- metadata.gz: dc3cc668e8c4697ec89ac2ac408ec9face29578ce250921f9af73e21a3752a77436b29ae8cf175d0710a9427bcedb6065ede9160ea22ec36b77d39878a5d396b
7
- data.tar.gz: 38575ccc855e0c752e046e005953d584f115b84481cde29895bea2a02df052182ee26f4b301299574866e7feba7bb96fd69af460a9fe645863c43f7187b9e656
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
@@ -1,4 +1,5 @@
1
1
  require "morse_spec_helpers/version"
2
+ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
2
3
 
3
4
  module MorseSpecHelpers
4
5
 
@@ -1,3 +1,3 @@
1
1
  module MorseSpecHelpers
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
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.1
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: