sunomono 0.2.0.pre → 0.3.0

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: f748b83e9bf8d3ac0915d62eea3116a31d22f553
4
- data.tar.gz: d50894040a6bd70af0d64bc35b997b49ca0e8c11
3
+ metadata.gz: c5a21e942c9b0b7cb73b862db3f30ca92605a393
4
+ data.tar.gz: e25df63ed527cbd79a2e3668f8dde2f862a530bd
5
5
  SHA512:
6
- metadata.gz: 8577fe27235665dd2ce17b5b6279fd75e2df01db093e4f00e3a349c4420ef630fa90eed3ec4ff7ee5fa5d3c7f626992653138c351e88c8b4bb6a4d0afac8bd52
7
- data.tar.gz: 695e55f0e463ed575748ac496bc5f98a328c33a24db5a89d114efbb53b3eda53362dd5b3977d4ee0720f138bca7c786839e449440eacbf4af34ed7e888c981a4
6
+ metadata.gz: c67b33691702e7df92e684de0c038b50e4ea30686119e194b4bbc87b0d49811a33550a72dff4e81977d657802a98d7416ab74aee085e9eea4d12ca50ae91de0a
7
+ data.tar.gz: f0eaafc32888d37a7f497c229166843fe4e2a7d50c426f8d6c602e859f86119452d506a695af6412521f9a76804f4193a416e5b98101089f4e80c5ac179f3dda
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ mkmf.log
15
15
  .irb-history
16
16
  .DS_Store
17
17
  .idea/
18
+ coverage
19
+ File::NULL
20
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format doc
3
+ --warning
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,30 @@
1
+ # Contributing
2
+
3
+ ## Fork
4
+
5
+ 1. Fork it ( https://github.com/concretesolutions/sunomono/fork )
6
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
7
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
8
+ 4. Push to the branch (`git push origin my-new-feature`)
9
+ 5. Create a new Pull Request
10
+
11
+ ## Pull request
12
+
13
+ 1. Include the purpose of this Pull Request on the description. For example:
14
+
15
+ ```
16
+ This is a spike to explore…
17
+
18
+ This simplifies the display of…
19
+
20
+ This fixes handling of…
21
+ ```
22
+ 2. Consider providing an overview of why the work is taking place
23
+ 3. Be explicit about when you want feedback, if the Pull Request is work in progress, say so. A prefix of “[WIP]” in the title is a simple, common pattern to indicate that state.
24
+
25
+
26
+ ## Best pratices
27
+
28
+ 1. Don't use tabs indentation
29
+ 2. Don't exceed 80 characters in line
30
+ 3. Write tests for new features
data/Gemfile CHANGED
@@ -7,3 +7,4 @@ gem 'thor'
7
7
  gem 'i18n'
8
8
  gem 'json'
9
9
  gem 'gherkin'
10
+ gem 'rspec'
data/README.md CHANGED
@@ -1,14 +1,8 @@
1
-
2
- ##[DEPRECATION]
3
-
4
- This gem has been renamed to sunomono and will no longer be supported. Please switch to sunomono as soon as possible.
5
-
6
- > See: https://rubygems.org/gems/sunomono
7
-
8
- > And: https://github.com/concretesolutions/sunomono
9
-
10
1
  # Sunomono
11
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/sunomono.svg)](https://badge.fury.io/rb/sunomono)
4
+
5
+ > ***The new version of [cs-bdd](https://rubygems.org/gems/cs-bdd) gem. cs-bdd was deprecated and will be yanked in the future. Always refer to sunomono from now on.***
12
6
 
13
7
  A simple gem to generate all files needed in a project that will support calabash for both Android and iOS.
14
8
 
@@ -17,7 +11,7 @@ iOS Build script works only with iOS SDK 9.2 or newer
17
11
  [Calabash](http://calaba.sh/) uses cucumber to support functional tests in Android and iOS and has one gem for each Platform:
18
12
 
19
13
  > calabash-android (for Android) [(link)](https://github.com/calabash/calabash-android)
20
-
14
+
21
15
  > calabash-cucumber (for iOS) [(link)](https://github.com/calabash/calabash-ios)
22
16
 
23
17
  The project structure is based on [this site](http://rubygemtsl.com/2014/01/06/designing-maintainable-calabash-tests-using-screen-objects-2). The structure is based on three layers: features, steps and screens.
@@ -27,7 +21,7 @@ The project structure is based on [this site](http://rubygemtsl.com/2014/01/06/d
27
21
  3. Screens: Contains all the Android and iOS screens. A screen must contain an identification, the declaration of all the elements of the screen and the declaration of its actions. This layer is Platform dependent. This occurs because, in almost every project, the identification of the elements varies between the Platforms. One example is that in Android almost all elements have an id, but in iOS the most common is to identify the elements by accessibility label. The Platform dependent screens must have the same name and same methods signatures. This will allow your steps to be unique between platforms
28
22
 
29
23
  > One example of this structure can be found in the generated files (see Usage) on the file base_steps.rb. This file implements some common steps to help you start your tests and show you how to uses the Platform dependent screens
30
-
24
+
31
25
  > In my experience with tests I saw some cases that we will need to test features that are Platform dependent, like screens that send SMS which will only apper in Android apps. When this happen, the generated structure has Features and Steps that are Platform dependent and can be found inside the folder `features/android` and `features/ios` of the generated project.
32
26
 
33
27
  ## Installation
@@ -75,10 +69,10 @@ If you use Windows, to avoid encoding problems, run the following command in cmd
75
69
  ```
76
70
 
77
71
 
78
- > The default language is English ('en'). The elements of Gherkin such as Given, When, Then, And, Scenario will be translated to all Gherkin supported languages, but this gem has just a few translation files (see that in folder: `lib/sunomono/locales`).
79
-
72
+ > The default language is English ('en'). The elements of Gherkin such as Given, When, Then, And, Scenario will be translated to all Gherkin supported languages, but this gem has just a few translation files (see that in folder: `lib/sunomono/locales`).
73
+
80
74
  > **Sunomono doesn't support your mother language?** No problem. Fork it, create your yml translation file, uses the en.yml file as a template. Translate it and make a pull request. There are only 15 lines to be translated, this will take no time.
81
-
75
+
82
76
  > **Want to know how to name your translation yml file?** See the Gherkin supported languages [here](https://github.com/cucumber/gherkin/blob/master/lib/gherkin/i18n.json) for reference.
83
77
 
84
78
  Once the project is created, open its folder (`cd ProjectName`) and run `bundle install`
@@ -96,8 +90,8 @@ There are nine generators that are responsible to create the templates for Featu
96
90
  suno generate feature FeatureName
97
91
  ```
98
92
  The feature generator will create a Platform independent feature and its files. So this command will create the FeatureName.feature file inside the folder `feature`, the file FeatureName_steps.rb inside the folder `features/step_definitions`, the files FeatureName_screen.rb inside the folders `features/android/screens` and `features/ios/screens`.
99
-
100
-
93
+
94
+
101
95
  ```
102
96
  suno generate android-feature AndroidFeatureName
103
97
  suno generate ios-feature iOSFeatureName
@@ -114,7 +108,7 @@ Don't forget about internationalization. All the generators accept the option `-
114
108
  ```
115
109
  The step generator will create a Platform independent step file named StepName_steps.rb in the folder `features/step_definitions`
116
110
 
117
-
111
+
118
112
  ```
119
113
  suno generate android-step AndroidStepName
120
114
  ```
@@ -148,10 +142,3 @@ The project contains a lot of scripts that will help you to configure you CI ser
148
142
 
149
143
  > Documentation under development.
150
144
 
151
- ## Contributing
152
-
153
- 1. Fork it ( https://github.com/concretesolutions/cs-bdd/fork )
154
- 2. Create your feature branch (`git checkout -b my-new-feature`)
155
- 3. Commit your changes (`git commit -am 'Add some feature'`)
156
- 4. Push to the branch (`git push origin my-new-feature`)
157
- 5. Create a new Pull Request
data/Rakefile CHANGED
@@ -1 +1,11 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :tests => [:spec]
5
+
6
+ desc 'Run the specs.'
7
+ RSpec::Core::RakeTask.new do |task|
8
+ task.pattern = 'spec/*_test.rb'
9
+ task.verbose = false
10
+ end
11
+
data/circle.yml ADDED
@@ -0,0 +1,13 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.3.0
4
+
5
+ dependencies:
6
+ override:
7
+ - gem install bundler
8
+ - gem install rake
9
+ - bundle install
10
+
11
+ test:
12
+ override:
13
+ - bundle exec rake spec
data/lib/skeleton/Gemfile CHANGED
@@ -2,6 +2,7 @@
2
2
  source 'https://rubygems.org'
3
3
 
4
4
  gem 'calabash-common'
5
- gem 'calabash-android', '~> 0.7'
6
- gem 'calabash-cucumber', '~> 0.19'
7
- gem 'sunomono', '~> 0.2'
5
+ gem 'calabash-android'
6
+ gem 'calabash-cucumber'
7
+ gem 'sunomono'
8
+ gem 'pry'
@@ -53,7 +53,7 @@ system <<eos
53
53
  xcodebuild -workspace "#{config['xcworkspace']}" \
54
54
  -scheme "#{config['scheme']}" -destination "#{config['destination']}" \
55
55
  -configuration "#{config['configuration']}" clean build \
56
- CONFIGURATION_BUILD_DIR="#{export_path}"
56
+ CONFIGURATION_BUILD_DIR="#{export_path}" | xcpretty
57
57
  eos
58
58
 
59
59
  # Getting the app folder that was created
@@ -3,3 +3,5 @@ if ENV['PLATFORM'] == 'ios'
3
3
  elsif ENV['PLATFORM'] == 'android'
4
4
  require 'calabash-android/cucumber'
5
5
  end
6
+
7
+ require 'pry'
@@ -10,9 +10,9 @@ en:
10
10
  steps:
11
11
  drag_until: 'I (?:drag|dragged) the screen (down|up|left|right) until I see the element "(.*?)"'
12
12
  page_contains: "I am on a page that contains '(.*?)'"
13
- drag_number_of_times: 'I drag the screen (left|right|down|up) (\d+) times'
13
+ drag_number_of_times: 'I (?:drag|dragged) the screen (left|right|down|up) (\d+) times'
14
14
  touch_element: 'I (?:touch|touched) the "(.*?)" element'
15
- drag_screen: "I drag the screen (down|up|left|right)"
15
+ drag_screen: "I (?:drag|dragged) the screen (down|up|left|right)"
16
16
  wait_progress_bar: "I (?:wait|waited) for the progress bar to vanish"
17
17
  should_see_page: "I should see the page '(.*?)'"
18
18
  should_see_page_that_contains: "I should see a page that contains '(.*?)'"
@@ -8,14 +8,14 @@ pt:
8
8
  elements: "Declare todos os elementos da tela"
9
9
  actions: "Declare todas as acoes da tela"
10
10
  steps:
11
- drag_until: 'que Eu (?:arrastei|arrasto) a tela para (baixo|cima|esquerda|direita) ate ver o elemento "(.*?)"'
12
- page_contains: "que Eu estou em uma pagina que contem '(.*?)'"
13
- drag_number_of_times: 'Eu arrasto a tela para (esquerda|direita|baixo|cima) (\d+) vezes'
14
- touch_element: 'Eu (?:clico|cliquei) no elemento "(.*?)"'
15
- drag_screen: "Eu arrasto a tela para (baixo|cima|esquerda|direita)"
16
- wait_progress_bar: "Eu (?:espero|esperei) ate a barra de progresso sumir"
17
- should_see_page: "Eu deveria ver a pagina '(.*?)'"
18
- should_see_page_that_contains: "Eu deveria ver uma pagina que contem '(.*?)'"
11
+ drag_until: 'que (?:Eu|eu) (?:arrastei|arrasto) a tela para (baixo|cima|esquerda|direita) ate ver o elemento "(.*?)"'
12
+ page_contains: "que (?:Eu|eu) estou em uma pagina que contem '(.*?)'"
13
+ drag_number_of_times: '(?:Eu|eu) (?:arrastei|arrasto) a tela para (esquerda|direita|baixo|cima) (\d+) vezes'
14
+ touch_element: '(?:Eu|eu) (?:clico|cliquei) no elemento "(.*?)"'
15
+ drag_screen: "(?:Eu|eu) (?:arrastei|arrasto) a tela para (baixo|cima|esquerda|direita)"
16
+ wait_progress_bar: "(?:Eu|eu) (?:espero|esperei) ate a barra de progresso sumir"
17
+ should_see_page: "(?:Eu|eu) deveria ver a pagina '(.*?)'"
18
+ should_see_page_that_contains: "(?:Eu|eu) deveria ver uma pagina que contem '(.*?)'"
19
19
  take_print: "faco um print"
20
20
  been_in_page: "que eu (?:estou|estava) na (?:pagina|tela)(?: de|) '(.*?)'"
21
21
  move_to_page: "eu (?:devo|deveria) estar na (?:pagina|tela)(?: de|) '(.*?)'"
@@ -1,3 +1,3 @@
1
1
  module Sunomono
2
- VERSION = '0.2.0.pre'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -123,7 +123,20 @@ class AndroidScreenBase < Calabash::ABase
123
123
  # Negation indicates that we want a page that doesn't
124
124
  # has the message passed as parameter
125
125
  def is_on_page?(page_text, negation = '')
126
- fail 'Error! Invalid query string!' if
126
+ fail 'Error! Invalid query string!' if
127
+ page_text.to_s == ''
128
+ begin
129
+ is_on_page!(page_text, negation)
130
+ rescue
131
+ return false
132
+ end
133
+ true
134
+ end
135
+
136
+ # Negation indicates that we want a page that doesn't
137
+ # has the message passed as parameter
138
+ def is_on_page!(page_text, negation = '')
139
+ fail 'Error! Invalid query string!' if
127
140
  page_text.to_s == ''
128
141
 
129
142
  should_not_have_exception = false
@@ -4,7 +4,7 @@
4
4
  end
5
5
 
6
6
  <%= I18n.translate( :given ).capitalize %>(/^<%= I18n.translate( "steps.page_contains" ) %>$/) do |page_text|
7
- @page.is_on_page? page_text
7
+ @page.is_on_page! page_text
8
8
  end
9
9
 
10
10
  ######### <%= I18n.translate( :when ).upcase %> #########
@@ -34,11 +34,11 @@ end
34
34
  end
35
35
 
36
36
  <%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.should_see_page" %>$/) do |page_text|
37
- @page.is_on_page? page_text
37
+ @page.is_on_page! page_text
38
38
  end
39
39
 
40
40
  <%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.should_see_page_that_contains" %>$/) do |page_text|
41
- @page.is_on_page? page_text
41
+ @page.is_on_page! page_text
42
42
  end
43
43
  <% unless I18n.config.default_locale == :en %>
44
44
 
@@ -142,10 +142,23 @@ class IOSScreenBase < Calabash::IBase
142
142
  end
143
143
  end
144
144
 
145
+ # Negation indicates that we want a page that doesn't
146
+ # has the message passed as parameter
147
+ def is_on_page?(page_text, negation = '')
148
+ fail 'Error! Invalid query string!' if
149
+ page_text.to_s == ''
150
+ begin
151
+ is_on_page!(page_text, negation)
152
+ rescue
153
+ return false
154
+ end
155
+ true
156
+ end
157
+
145
158
  # Negation indicates that we want a page that doesn't has
146
159
  # the message passed as parameter
147
- def is_on_page?(page_text, negation = '')
148
- fail 'Error! Invalid query string!' if
160
+ def is_on_page!(page_text, negation = '')
161
+ fail 'Error! Invalid query string!' if
149
162
  page_text.to_s == ''
150
163
 
151
164
  should_not_have_exception = false
@@ -0,0 +1,306 @@
1
+ require 'sunomono'
2
+
3
+ describe Sunomono do
4
+
5
+ before(:each) do
6
+ @project_name = 'Sunomono_test'
7
+ @feature_name = 'sunomono'
8
+ end
9
+
10
+ after(:each) do
11
+ Dir.chdir('..') unless Dir.exist?(@project_name)
12
+ FileUtils.rm_rf(@project_name)
13
+ end
14
+
15
+ describe 'Sunomono gem commands' do
16
+ context 'Returns project created with all files' do
17
+ it 'Create new project using default command' do
18
+ system "sunomono new '#{@project_name}' > /dev/null"
19
+
20
+ expect(Dir.entries(@project_name)).
21
+ to include('screenshots', 'features', 'config', 'README.md', 'Gemfile', '.gitignore')
22
+ # Features files
23
+ expect(Dir.entries("#{@project_name}/features")).
24
+ to include('android', 'ios', 'step_definitions', 'support')
25
+ expect(Dir.entries("#{@project_name}/features/android")).
26
+ to include('android_screen_base.rb', 'features', 'screens', 'step_definitions', 'support')
27
+ expect(Dir.entries("#{@project_name}/features/ios")).
28
+ to include('ios_screen_base.rb', 'features', 'screens', 'step_definitions', 'support')
29
+ expect(Dir.entries("#{@project_name}/features/step_definitions")).
30
+ to include('base_steps.rb')
31
+ expect(Dir.entries("#{@project_name}/features/support")).
32
+ to include('env.rb', 'exceptions.rb')
33
+
34
+ # Config files
35
+ expect(Dir.entries("#{@project_name}/config")).
36
+ to include('cucumber.yml', 'email', 'load_classes.rb', 'scripts')
37
+
38
+ # Email files
39
+ expect(Dir.entries("#{@project_name}/config/email")).
40
+ to include('template.html')
41
+
42
+ # Scripts files
43
+ expect(Dir.entries("#{@project_name}/config/scripts")).
44
+ to include('android', 'break_build_if_failed.sh', 'check_if_tests_failed.sh', 'ios')
45
+ expect(Dir.entries("#{@project_name}/config/scripts/android")).
46
+ to include('run_tests_all_devices.sh', 'start_emulators.sh', 'stop_emulators.sh')
47
+ expect(Dir.entries("#{@project_name}/config/scripts/ios")).
48
+ to include('.', '..', 'build_app.rb', 'build_app.yml', 'devices.txt', 'run_tests_all_devices.sh')
49
+ end
50
+ end
51
+
52
+ context 'Try creates new project with a invalid argument' do
53
+ it 'Project will not be generated' do
54
+ system "suno new '#{@project_name}' invalid argument > /dev/null"
55
+
56
+ expect(Dir.entries(".")).
57
+ not_to include("#{@project_name}")
58
+ end
59
+ end
60
+
61
+ context 'Should return the latest version of sunonomo' do
62
+ it 'Returns the latest version' do
63
+ stdout = `sunomono version`
64
+ version = "Sunomono Version " + "#{Sunomono::VERSION}"
65
+
66
+ expect(version).
67
+ to include(stdout.gsub(/\n/, ""))
68
+ end
69
+ end
70
+
71
+ context 'Generate Feature' do
72
+ it 'Generates all files' do
73
+ system "sunomono new '#{@project_name}' > /dev/null"
74
+
75
+ Dir.chdir(@project_name)
76
+
77
+ system "sunomono generate feature '#{@feature_name}' > /dev/null"
78
+
79
+ expect(Dir.entries("features")).
80
+ to include("#{@feature_name}.feature")
81
+ expect(Dir.entries("features/step_definitions")).
82
+ to include("#{@feature_name}_steps.rb")
83
+ expect(Dir.entries("features/android/screens")).
84
+ to include("#{@feature_name}_screen.rb")
85
+ expect(Dir.entries("features/ios/screens")).
86
+ to include("#{@feature_name}_screen.rb")
87
+ end
88
+
89
+ it 'Generate feature in pt' do
90
+ system "suno new '#{@project_name}' > /dev/null"
91
+
92
+ Dir.chdir(@project_name)
93
+
94
+ system "suno generate feature '#{@feature_name}' --lang=pt > /dev/null"
95
+
96
+ expect(File.readlines("features/#{@feature_name}.feature")).
97
+ to include("# language: pt\n", "Funcionalidade: #{@feature_name.capitalize} \n", "\n", " Contexto:\n", " # Insira os passos\n", " \n", " Cenário: Primeiro Cenario\n", " # Insira os passos\n")
98
+ expect(File.readlines("features/step_definitions/#{@feature_name}_steps.rb")).
99
+ to include("######### DADO #########\n", "\n", "######### QUANDO #########\n", "\n", "######### ENTãO #########")
100
+ end
101
+
102
+ it 'Generate feature in en' do
103
+ system "suno new '#{@project_name}' > /dev/null"
104
+
105
+ Dir.chdir(@project_name)
106
+
107
+ system "suno generate feature '#{@feature_name}' > /dev/null"
108
+
109
+ expect(File.readlines("features/#{@feature_name}.feature")).
110
+ to include("# language: en\n", "Feature: #{@feature_name.capitalize} \n", "\n", " Background:\n", " # Insert steps\n", " \n", " Scenario: First Scenario\n", " # Insert steps\n")
111
+ expect(File.readlines("features/step_definitions/#{@feature_name}_steps.rb")).
112
+ to include("######### GIVEN #########\n", "\n", "######### WHEN #########\n", "\n", "######### THEN #########")
113
+ end
114
+
115
+ it 'Generates with alias command g' do
116
+ system "suno new '#{@project_name}' > /dev/null"
117
+
118
+ Dir.chdir(@project_name)
119
+
120
+ system "suno g feature '#{@feature_name}' > /dev/null"
121
+
122
+ expect(Dir.entries("features")).
123
+ to include("#{@feature_name}.feature")
124
+ expect(Dir.entries("features/step_definitions")).
125
+ to include("#{@feature_name}_steps.rb")
126
+ expect(Dir.entries("features/android/screens")).
127
+ to include("#{@feature_name}_screen.rb")
128
+ expect(Dir.entries("features/ios/screens")).
129
+ to include("#{@feature_name}_screen.rb")
130
+ end
131
+ end
132
+
133
+ context 'Try Generates a feature with a invalid argument' do
134
+ it 'Feature will be not created' do
135
+ system "sunomono new '#{@project_name}' > /dev/null"
136
+
137
+ Dir.chdir(@project_name)
138
+
139
+ system "sunomono generate feature '#{@feature_name}' invalid_argument > /dev/null"
140
+
141
+ expect(Dir.entries("features")).
142
+ not_to include("#{@feature_name}.feature")
143
+ expect(Dir.entries("features/step_definitions")).
144
+ not_to include("#{@feature_name}_steps.rb")
145
+ expect(Dir.entries("features/android/screens")).
146
+ not_to include("#{@feature_name}_screen.rb")
147
+ expect(Dir.entries("features/ios/screens")).
148
+ not_to include("#{@feature_name}_screen.rb")
149
+ end
150
+
151
+ it 'Feature will be not created using alias command suno with a invalid argument' do
152
+ system "suno new '#{@project_name}'", :out => File::NULL
153
+
154
+ Dir.chdir(@project_name)
155
+
156
+ system "suno generate feature '#{@feature_name}' invalid_argument > /dev/null"
157
+
158
+ expect(Dir.entries("features")).
159
+ not_to include("#{@feature_name}.feature")
160
+ expect(Dir.entries("features/step_definitions")).
161
+ not_to include("#{@feature_name}_steps.rb")
162
+ expect(Dir.entries("features/android/screens")).
163
+ not_to include("#{@feature_name}_screen.rb")
164
+ expect(Dir.entries("features/ios/screens")).
165
+ not_to include("#{@feature_name}_screen.rb")
166
+ end
167
+
168
+
169
+ it 'Feature will be not created using alias command with a invalid argument' do
170
+ system "suno new '#{@project_name}' > /dev/null"
171
+
172
+ Dir.chdir(@project_name)
173
+
174
+ system "suno g feature '#{@feature_name}' invalid_argument > /dev/null"
175
+
176
+ expect(Dir.entries("features")).
177
+ not_to include("#{@feature_name}.feature")
178
+ expect(Dir.entries("features/step_definitions")).
179
+ not_to include("#{@feature_name}_steps.rb")
180
+ expect(Dir.entries("features/android/screens")).
181
+ not_to include("#{@feature_name}_screen.rb")
182
+ expect(Dir.entries("features/ios/screens")).
183
+ not_to include("#{@feature_name}_screen.rb")
184
+ end
185
+ end
186
+
187
+ context 'Generates an OS independent step' do
188
+ it 'Cant generates .feature and screens files' do
189
+ system "suno new #{@project_name} > /dev/null"
190
+
191
+ Dir.chdir(@project_name)
192
+
193
+ system "sunomono generate step #{@feature_name} > /dev/null"
194
+
195
+ expect(Dir.entries("features")).
196
+ not_to include("#{@feature_name}.feature")
197
+ expect(Dir.entries("features/android")).
198
+ not_to include("#{@feature_name}_screen.rb")
199
+ expect(Dir.entries("features/ios")).
200
+ not_to include("#{@feature_name}_screen.rb")
201
+ end
202
+ end
203
+
204
+ context 'Generates an OS indenpendent screen' do
205
+ it 'Cant generates .feature and step_definition files' do
206
+ system "suno new #{@project_name} > /dev/null"
207
+
208
+ Dir.chdir(@project_name)
209
+
210
+ system "sunomono generate screen #{@feature_name} > /dev/null"
211
+
212
+ expect(Dir.entries("features")).
213
+ not_to include("#{@feature_name}.feature")
214
+ expect(Dir.entries("features/step_definitions")).
215
+ not_to include("#{@feature_name}_steps.rb")
216
+ end
217
+ end
218
+
219
+ context 'commands to generates an Android dependent files' do
220
+ it 'Create folders to android plataform' do
221
+ system "suno new #{@project_name} > /dev/null"
222
+
223
+ Dir.chdir(@project_name)
224
+
225
+ system "suno generate android-feature #{@feature_name} > /dev/null"
226
+
227
+ expect(Dir.entries("features/android/features")).
228
+ to include("#{@feature_name}.feature")
229
+ expect(Dir.entries("features/android/step_definitions")).
230
+ to include("#{@feature_name}_steps.rb")
231
+ expect(Dir.entries("features/android/screens")).
232
+ to include("#{@feature_name}_screen.rb")
233
+ end
234
+
235
+ it 'Create screen to android plataform' do
236
+ system "suno new #{@project_name} > /dev/null"
237
+
238
+ Dir.chdir(@project_name)
239
+
240
+ system "suno generate android-screen #{@feature_name} > /dev/null"
241
+
242
+ expect(Dir.entries("features/android/features")).
243
+ not_to include("#{@feature_name}.feature")
244
+ expect(Dir.entries("features/android/step_definitions")).
245
+ not_to include("#{@feature_name}_steps.rb")
246
+ end
247
+
248
+ it 'Create step to android plataform' do
249
+ system "suno new #{@project_name} > /dev/null"
250
+
251
+ Dir.chdir(@project_name)
252
+
253
+ system "suno generate android-step #{@feature_name} > /dev/null"
254
+
255
+ expect(Dir.entries("features/android/features")).
256
+ not_to include("#{@feature_name}.feature")
257
+ expect(Dir.entries("features/android/screens")).
258
+ not_to include("#{@feature_name}_screen.rb")
259
+ end
260
+ end
261
+
262
+ context 'commands to generates an IOS dependent files' do
263
+ it 'Create folders to IOS plataform' do
264
+ system "suno new #{@project_name} > /dev/null"
265
+
266
+ Dir.chdir(@project_name)
267
+
268
+ system "suno generate ios-feature #{@feature_name} > /dev/null"
269
+
270
+ expect(Dir.entries("features/ios/features")).
271
+ to include("#{@feature_name}.feature")
272
+ expect(Dir.entries("features/ios/step_definitions")).
273
+ to include("#{@feature_name}_steps.rb")
274
+ expect(Dir.entries("features/ios/screens")).
275
+ to include("#{@feature_name}_screen.rb")
276
+ end
277
+
278
+ it 'Create screen to IOS plataform' do
279
+ system "suno new #{@project_name} > /dev/null"
280
+
281
+ Dir.chdir(@project_name)
282
+
283
+ system "suno generate ios-screen #{@feature_name} > /dev/null"
284
+
285
+ expect(Dir.entries("features/ios/features")).
286
+ not_to include("#{@feature_name}.feature")
287
+ expect(Dir.entries("features/ios/step_definitions")).
288
+ not_to include("#{@feature_name}_steps.rb")
289
+ end
290
+
291
+ it 'Create step to IOS plataform' do
292
+ system "suno new #{@project_name} > /dev/null"
293
+
294
+ Dir.chdir(@project_name)
295
+
296
+ system "suno generate ios-step #{@feature_name} > /dev/null"
297
+
298
+ expect(Dir.entries("features/ios/features")).
299
+ not_to include("#{@feature_name}.feature")
300
+ expect(Dir.entries("features/ios/screens")).
301
+ not_to include("#{@feature_name}_screen.rb")
302
+ end
303
+ end
304
+ end
305
+ end
306
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunomono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Tanner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-19 00:00:00.000000000 Z
11
+ date: 2017-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,12 +105,15 @@ extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
107
  - ".gitignore"
108
+ - ".rspec"
109
+ - CONTRIBUTING.md
108
110
  - Gemfile
109
111
  - LICENSE.txt
110
112
  - README.md
111
113
  - Rakefile
112
114
  - bin/suno
113
115
  - bin/sunomono
116
+ - circle.yml
114
117
  - lib/aws/android/app_installation_hooks.rb
115
118
  - lib/aws/android/app_life_cycle_hooks.rb
116
119
  - lib/aws/ios/01_launch.rb
@@ -156,6 +159,7 @@ files:
156
159
  - lib/templates/ios_screen_base.tt
157
160
  - lib/templates/screen.tt
158
161
  - lib/templates/steps.tt
162
+ - spec/sunomono_test.rb
159
163
  - sunomono.gemspec
160
164
  homepage: https://github.com/concretesolutions/sunomono
161
165
  licenses:
@@ -172,13 +176,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
176
  version: '0'
173
177
  required_rubygems_version: !ruby/object:Gem::Requirement
174
178
  requirements:
175
- - - ">"
179
+ - - ">="
176
180
  - !ruby/object:Gem::Version
177
- version: 1.3.1
181
+ version: '0'
178
182
  requirements: []
179
183
  rubyforge_project:
180
- rubygems_version: 2.5.1
184
+ rubygems_version: 2.6.8
181
185
  signing_key:
182
186
  specification_version: 4
183
187
  summary: Generates an android and iOS calabash project.
184
- test_files: []
188
+ test_files:
189
+ - spec/sunomono_test.rb