ruby_raider 0.3.1 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 151af21fd6a33598fc5fef983b3d8277817e438445f8576d6f6135ce13d7cc4b
4
- data.tar.gz: 0665e396c6246632ab922e62fac8dd3ef66701815b95bb8cdc03fa215b7a57b6
3
+ metadata.gz: 3b40b177b2b89c4585ae988d6c1747e7eb58761d4817cac54a194ae532f80d77
4
+ data.tar.gz: e758ab9ef9922f963b5f3da0763713c7c1cba1890d1d6974b687a6fa62a7eaed
5
5
  SHA512:
6
- metadata.gz: 613640d0d946f4337bec680bdac7c86e4ae6f00534b7286d6e35a59788197b4f37dd110a4ee3990247e8b2dffee2f7eafc6d92de1b9a6f3216ae88343cd0cc43
7
- data.tar.gz: 3391b2d3debb45de3d923954f64d8c866fb813f276312128c81a4fde78964a56084142ca6266399277b9c4280296da36f495ff3c9e754a4ef90fb16659fd3736
6
+ metadata.gz: 574e301014b379f362a08aba90a5dda00391210c602d751a0f6e953c37f19c9c07364c9556944eae47b5ef15a58f2170b1530436fef6c520454895de72f8c253
7
+ data.tar.gz: a2f4a9319b508daf6ffb39498eeeacb97b1544ddd44eb19e9832c2db69c121c8df7c784002de9e5847e9d6732db997b63996d98ea285eda8f4c10544f170f8dd
data/README.md CHANGED
@@ -31,6 +31,8 @@ This works in all the platforms (Tested on Mac OS, Linux and Windows)
31
31
 
32
32
  raider help [COMMAND] # Describe available commands or one specific command
33
33
 
34
+ raider helper [HELPER_NAME] # Creates a new helper
35
+
34
36
  raider new [PROJECT_NAME] # Creates a new framework based on settings picked
35
37
 
36
38
  raider page [PAGE_NAME] # Creates a new page object
@@ -44,14 +46,15 @@ This works in all the platforms (Tested on Mac OS, Linux and Windows)
44
46
  raider url [URL] # Sets the default url for a project
45
47
  ```
46
48
 
47
- It's possible to add the option --path or -p if you want to specify where to create your features, pages and specs.
48
- And also it's possible to delete them using --delete or -d.
49
+ It's possible to add the option --path or -p if you want to specify where to create your features, pages, helpers and
50
+ specs.
49
51
 
50
- If you want to set the default path for the creation of your features, specs or pages you can do:
52
+ If you want to set the default path for the creation of your features, helpers and specs:
51
53
 
52
54
  ```
53
55
  raider path [PATH_NAME] --feature or -f
54
56
  raider path [PATH_NAME] --spec or -s
57
+ raider path [PATH_NAME] --helper or -h
55
58
  ```
56
59
 
57
60
  If you don't specify an option path will assume you want to change the default path for pages
@@ -1,4 +1,5 @@
1
1
  # Ruby Raider
2
+
2
3
  This is a gem to make setup and start of UI automation projects easier
3
4
  You can find more information and updates on releases in : https://ruby-raider.com/
4
5
 
@@ -30,6 +31,8 @@ This works in all the platforms (Tested on Mac OS, Linux and Windows)
30
31
 
31
32
  raider help [COMMAND] # Describe available commands or one specific command
32
33
 
34
+ raider helper [HELPER_NAME] # Creates a new helper
35
+
33
36
  raider new [PROJECT_NAME] # Creates a new framework based on settings picked
34
37
 
35
38
  raider page [PAGE_NAME] # Creates a new page object
@@ -43,14 +46,15 @@ This works in all the platforms (Tested on Mac OS, Linux and Windows)
43
46
  raider url [URL] # Sets the default url for a project
44
47
  ```
45
48
 
46
- It's possible to add the option --path or -p if you want to specify where to create your features, pages and specs.
47
- And also it's possible to delete them using --delete or -d.
49
+ It's possible to add the option --path or -p if you want to specify where to create your features, pages, helpers and
50
+ specs.
48
51
 
49
- If you want to set the default path for the creation of your features, specs or pages you can do:
52
+ If you want to set the default path for the creation of your features, helpers and specs:
50
53
 
51
54
  ```
52
55
  raider path [PATH_NAME] --feature or -f
53
56
  raider path [PATH_NAME] --spec or -s
57
+ raider path [PATH_NAME] --helper or -h
54
58
  ```
55
59
 
56
60
  If you don't specify an option path will assume you want to change the default path for pages
data/lib/ruby_raider.rb CHANGED
@@ -56,9 +56,26 @@ class RubyRaider < Thor
56
56
  end
57
57
  end
58
58
 
59
+ desc "helper [HELPER_NAME]", "Creates a new helper"
60
+ option :path,
61
+ :type => :string, :required => false, :desc => 'The path where your helper will be created', :aliases => '-p'
62
+ option :delete,
63
+ :type => :boolean, :required => false, :desc => 'This will delete the selected helper', :aliases => '-d'
64
+
65
+ def helper(name)
66
+ path = options[:path].nil? ? load_config_path('helper') : options[:path]
67
+ if options[:delete]
68
+ Scaffolding.new([name, path]).delete_helper
69
+ else
70
+ Scaffolding.new([name, path]).generate_helper
71
+ end
72
+ end
73
+
59
74
  desc "path [PATH]", "Sets the default path for scaffolding"
60
75
  option :feature,
61
76
  :type => :boolean, :required => false, :desc => 'The default path for your features', :aliases => '-f'
77
+ option :helper,
78
+ :type => :boolean, :required => false, :desc => 'The default path for your helpers', :aliases => '-h'
62
79
  option :spec,
63
80
  :type => :boolean, :required => false, :desc => 'The default path for your specs', :aliases => '-s'
64
81
  def path(default_path)
@@ -22,6 +22,10 @@ class Scaffolding < Thor::Group
22
22
  template('spec.tt', default_path("spec/#{name}_spec.rb", '_spec.rb'))
23
23
  end
24
24
 
25
+ def generate_helper
26
+ template('helper.tt', default_path("helpers/#{name}_helper.rb", '_helper.rb'))
27
+ end
28
+
25
29
  def delete_class
26
30
  remove_file(default_path("page_objects/pages/#{name}_page.rb", '_page.rb'))
27
31
  end
@@ -34,6 +38,10 @@ class Scaffolding < Thor::Group
34
38
  remove_file(default_path("spec/#{name}_spec.rb", '_spec.rb'))
35
39
  end
36
40
 
41
+ def delete_helper
42
+ remove_file(default_path("helpers/#{name}_helper.rb", '_helper.rb'))
43
+ end
44
+
37
45
  def default_path(standard_path, file_type)
38
46
  path.nil? ? standard_path : "#{path}/#{name}#{file_type}"
39
47
  end
@@ -0,0 +1,3 @@
1
+ module <%= name.split('_').map {|word| word.capitalize }.join + 'Helper' %>
2
+ # Add your helper code here
3
+ end
@@ -26,6 +26,11 @@ class Utilities
26
26
  overwrite_yaml
27
27
  end
28
28
 
29
+ def helper_path=(path)
30
+ @config['helper_path'] = path
31
+ overwrite_yaml
32
+ end
33
+
29
34
  def url=(url)
30
35
  @config['url'] = url
31
36
  overwrite_yaml
data/ruby_raider.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ruby_raider'
5
- s.version = '0.3.1'
5
+ s.version = '0.3.2'
6
6
  s.summary = 'A gem to make setup and start of UI automation projects easier'
7
7
  s.description = 'This gem has everything you need to start working with test automation'
8
8
  s.authors = ['Agustin Pequeno']
@@ -29,6 +29,11 @@ describe RubyRaider do
29
29
  expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
30
30
  end
31
31
 
32
+ it 'creates a helper' do
33
+ raider.new.invoke(:helper, nil, %W[#{name}])
34
+ expect(Pathname.new("helpers/#{name}_helper.rb")).to be_file
35
+ end
36
+
32
37
  it 'deletes a page' do
33
38
  raider.new.invoke(:page, nil, %W[#{name}])
34
39
  raider.new.invoke(:page, nil, %W[#{name} --delete])
@@ -47,8 +52,14 @@ describe RubyRaider do
47
52
  expect(Pathname.new("spec/#{name}_spec.rb")).to_not be_file
48
53
  end
49
54
 
55
+ it 'deletes a helper' do
56
+ raider.new.invoke(:helper, nil, %W[#{name}])
57
+ raider.new.invoke(:helper, nil, %W[#{name} --delete])
58
+ expect(Pathname.new("helpers/#{name}_helper.rb")).to_not be_file
59
+ end
60
+
50
61
  after(:all) do
51
- folders = %w[test config page_objects features]
62
+ folders = %w[test config page_objects features helpers]
52
63
  folders.each do |folder|
53
64
  FileUtils.rm_rf(folder)
54
65
  end
@@ -74,6 +85,11 @@ describe RubyRaider do
74
85
  expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
75
86
  end
76
87
 
88
+ it 'creates a helper' do
89
+ raider.new.invoke(:helper, nil, %W[#{name} --path #{path}])
90
+ expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
91
+ end
92
+
77
93
  after(:each) do
78
94
  FileUtils.rm_rf(path)
79
95
  end
@@ -117,12 +133,18 @@ describe RubyRaider do
117
133
  expect(Pathname.new("#{path}/#{name}.feature")).to be_file
118
134
  end
119
135
 
120
- it 'creates feature' do
136
+ it 'creates spec' do
121
137
  raider.new.invoke(:path, nil, %W[#{path} -s])
122
138
  raider.new.invoke(:spec, nil, %W[#{name}])
123
139
  expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
124
140
  end
125
141
 
142
+ it 'creates spec' do
143
+ raider.new.invoke(:path, nil, %W[#{path} -h])
144
+ raider.new.invoke(:helper, nil, %W[#{name}])
145
+ expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
146
+ end
147
+
126
148
  after(:all) do
127
149
  folders = %w[test_folder test config]
128
150
  folders.each do |folder|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_raider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
@@ -180,6 +180,7 @@ files:
180
180
  - lib/ruby_raider.rb
181
181
  - lib/scaffolding/scaffolding.rb
182
182
  - lib/scaffolding/templates/feature.tt
183
+ - lib/scaffolding/templates/helper.tt
183
184
  - lib/scaffolding/templates/page_object.tt
184
185
  - lib/scaffolding/templates/spec.tt
185
186
  - lib/utilities/utilities.rb