lazyman 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f880012f16584ac982e470140c32569f2cead0e0
4
+ data.tar.gz: 966738fd8d8a5b1e848559bb20c03a8cd8cd27f2
5
+ SHA512:
6
+ metadata.gz: 6d4399f007071a77df974ee26461751aac1500cc193811f6a0d084ae255e9f721080ff00a78df72cc9e944bb5933bbdc1fe92d10c7ecd3ad873be99d1611a94d
7
+ data.tar.gz: c09355d5ac32acb65ce618ce9be9014e6610523cde1621033730bef7d895553244da0102dcf5c7e80adfb20b921c4557791f5173cb4595a91e96974fd45dc59c
data/Gemfile CHANGED
@@ -5,17 +5,12 @@ source "http://ruby.taobao.org"
5
5
 
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
- gem "rspec", ">= 2.13.0"
9
- gem "page-object", ">= 0.8.6.1"
10
- gem "thor", ">= 0.14.6"
11
- gem "active_support", "~> 3.0.0"
8
+ gem "rspec"
9
+ gem "page-object"
10
+ gem "thor"
12
11
 
13
12
  group :development do
14
- gem "rdoc", "~> 3.12"
15
- gem "bundler", "~> 1.0.0"
16
- gem "jeweler", "~> 1.8.4"
17
- gem "rspec", ">= 2.13.0"
18
- gem "page-object", ">= 0.8.6.1"
19
- gem "thor", ">= 0.14.6"
20
- gem "active_support", "~> 3.0.0"
13
+ gem "rdoc"
14
+ gem "bundler"
15
+ gem "jeweler"
21
16
  end
@@ -1,64 +1,62 @@
1
- GEM
2
- remote: http://ruby.taobao.org/
3
- specs:
4
- active_support (3.0.0)
5
- activesupport (= 3.0.0)
6
- activesupport (3.0.0)
7
- childprocess (0.3.9)
8
- ffi (~> 1.0, >= 1.0.11)
9
- data_magic (0.14)
10
- faker (>= 1.1.2)
11
- yml_reader (>= 0.2)
12
- diff-lcs (1.2.4)
13
- faker (1.1.2)
14
- i18n (~> 0.5)
15
- ffi (1.6.0-x86-mingw32)
16
- git (1.2.5)
17
- i18n (0.6.4)
18
- jeweler (1.8.4)
19
- bundler (~> 1.0)
20
- git (>= 1.2.5)
21
- rake
22
- rdoc
23
- json (1.7.7)
24
- multi_json (1.7.2)
25
- page-object (0.8.6.1)
26
- page_navigation (>= 0.7)
27
- selenium-webdriver (>= 2.31.0)
28
- watir-webdriver (>= 0.6.2)
29
- page_navigation (0.7)
30
- data_magic (>= 0.14)
31
- rake (10.0.4)
32
- rdoc (3.12.2)
33
- json (~> 1.4)
34
- rspec (2.14.1)
35
- rspec-core (~> 2.14.0)
36
- rspec-expectations (~> 2.14.0)
37
- rspec-mocks (~> 2.14.0)
38
- rspec-core (2.14.3)
39
- rspec-expectations (2.14.0)
40
- diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.14.1)
42
- rubyzip (0.9.9)
43
- selenium-webdriver (2.31.0)
44
- childprocess (>= 0.2.5)
45
- multi_json (~> 1.0)
46
- rubyzip
47
- websocket (~> 1.0.4)
48
- thor (0.14.6)
49
- watir-webdriver (0.6.2)
50
- selenium-webdriver (>= 2.18.0)
51
- websocket (1.0.7)
52
- yml_reader (0.2)
53
-
54
- PLATFORMS
55
- x86-mingw32
56
-
57
- DEPENDENCIES
58
- active_support (~> 3.0.0)
59
- bundler (~> 1.0.0)
60
- jeweler (~> 1.8.4)
61
- page-object (>= 0.8.6.1)
62
- rdoc (~> 3.12)
63
- rspec (>= 2.13.0)
64
- thor (>= 0.14.6)
1
+ GEM
2
+ remote: http://ruby.taobao.org/
3
+ specs:
4
+ childprocess (0.3.9)
5
+ ffi (~> 1.0, >= 1.0.11)
6
+ data_magic (0.14)
7
+ faker (>= 1.1.2)
8
+ yml_reader (>= 0.2)
9
+ diff-lcs (1.2.4)
10
+ faker (1.1.2)
11
+ i18n (~> 0.5)
12
+ ffi (1.6.0)
13
+ ffi (1.6.0-x86-mingw32)
14
+ git (1.2.5)
15
+ i18n (0.6.4)
16
+ jeweler (1.8.4)
17
+ bundler (~> 1.0)
18
+ git (>= 1.2.5)
19
+ rake
20
+ rdoc
21
+ json (1.7.7)
22
+ multi_json (1.7.2)
23
+ page-object (0.8.6.1)
24
+ page_navigation (>= 0.7)
25
+ selenium-webdriver (>= 2.31.0)
26
+ watir-webdriver (>= 0.6.2)
27
+ page_navigation (0.7)
28
+ data_magic (>= 0.14)
29
+ rake (10.0.4)
30
+ rdoc (3.12.2)
31
+ json (~> 1.4)
32
+ rspec (2.14.1)
33
+ rspec-core (~> 2.14.0)
34
+ rspec-expectations (~> 2.14.0)
35
+ rspec-mocks (~> 2.14.0)
36
+ rspec-core (2.14.3)
37
+ rspec-expectations (2.14.0)
38
+ diff-lcs (>= 1.1.3, < 2.0)
39
+ rspec-mocks (2.14.1)
40
+ rubyzip (0.9.9)
41
+ selenium-webdriver (2.31.0)
42
+ childprocess (>= 0.2.5)
43
+ multi_json (~> 1.0)
44
+ rubyzip
45
+ websocket (~> 1.0.4)
46
+ thor (0.14.6)
47
+ watir-webdriver (0.6.2)
48
+ selenium-webdriver (>= 2.18.0)
49
+ websocket (1.0.7)
50
+ yml_reader (0.2)
51
+
52
+ PLATFORMS
53
+ ruby
54
+ x86-mingw32
55
+
56
+ DEPENDENCIES
57
+ bundler
58
+ jeweler
59
+ page-object
60
+ rdoc
61
+ rspec
62
+ thor
data/README.md CHANGED
@@ -15,10 +15,6 @@ Install lazyman from rubygems
15
15
 
16
16
  Or clone from github, build the gem and install
17
17
 
18
- If you have any issue when install lazyman, install the gems below:
19
-
20
- gem install thor
21
-
22
18
 
23
19
  Create a lazyman project
24
20
  ------------------------
@@ -77,6 +73,12 @@ Lazyman project has a clean and simple structure.
77
73
 
78
74
  * app->matchers: defind your owner rspec matchers here.
79
75
 
76
+ How to fix rspec issue with GBK encoding
77
+ ----------------------------------------
78
+
79
+ [Here](http://www.cnblogs.com/timsheng/p/3603679.html) is the solution.
80
+
81
+
80
82
 
81
83
  Contributing to lazyman
82
84
  -----------------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.14
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env ruby
2
-
3
- lazyman_path = File.expand_path('../../lib', __FILE__)
4
- #puts lazyman_path
5
- $:.unshift(lazyman_path)
6
-
7
- require 'lazyman/cli'
1
+ #!/usr/bin/env ruby
2
+
3
+ lazyman_path = File.expand_path('../../lib', __FILE__)
4
+ #puts lazyman_path
5
+ $:.unshift(lazyman_path)
6
+
7
+ require 'lazyman/cli'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lazyman"
8
- s.version = "0.1.13"
8
+ s.version = "0.1.14"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["easonhan"]
12
- s.date = "2013-07-24"
12
+ s.date = "2015-07-24"
13
13
  s.description = "A test framework using watir-webdriver rspec and page-object"
14
14
  s.email = "nbkhic@qq.com"
15
15
  s.executables = ["lazyman"]
@@ -91,42 +91,27 @@ Gem::Specification.new do |s|
91
91
  s.specification_version = 3
92
92
 
93
93
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
94
- s.add_runtime_dependency(%q<rspec>, [">= 2.13.0"])
95
- s.add_runtime_dependency(%q<page-object>, [">= 0.8.6.1"])
96
- s.add_runtime_dependency(%q<thor>, [">= 0.14.6"])
97
- s.add_runtime_dependency(%q<active_support>, ["~> 3.0.0"])
98
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
99
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
100
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
101
- s.add_development_dependency(%q<rspec>, [">= 2.13.0"])
102
- s.add_development_dependency(%q<page-object>, [">= 0.8.6.1"])
103
- s.add_development_dependency(%q<thor>, [">= 0.14.6"])
104
- s.add_development_dependency(%q<active_support>, ["~> 3.0.0"])
94
+ s.add_runtime_dependency(%q<rspec>)
95
+ s.add_runtime_dependency(%q<page-object>)
96
+ s.add_runtime_dependency(%q<thor>)
97
+ s.add_development_dependency(%q<rdoc>)
98
+ s.add_development_dependency(%q<bundler>)
99
+ s.add_development_dependency(%q<jeweler>)
105
100
  else
106
- s.add_dependency(%q<rspec>, [">= 2.13.0"])
107
- s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
108
- s.add_dependency(%q<thor>, [">= 0.14.6"])
109
- s.add_dependency(%q<active_support>, ["~> 3.0.0"])
110
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
111
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
112
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
113
- s.add_dependency(%q<rspec>, [">= 2.13.0"])
114
- s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
115
- s.add_dependency(%q<thor>, [">= 0.14.6"])
116
- s.add_dependency(%q<active_support>, ["~> 3.0.0"])
101
+ s.add_dependency(%q<rspec>)
102
+ s.add_dependency(%q<page-object>)
103
+ s.add_dependency(%q<thor>)
104
+ s.add_dependency(%q<rdoc>)
105
+ s.add_dependency(%q<bundler>)
106
+ s.add_dependency(%q<jeweler>)
117
107
  end
118
108
  else
119
- s.add_dependency(%q<rspec>, [">= 2.13.0"])
120
- s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
121
- s.add_dependency(%q<thor>, [">= 0.14.6"])
122
- s.add_dependency(%q<active_support>, ["~> 3.0.0"])
123
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
124
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
125
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
126
- s.add_dependency(%q<rspec>, [">= 2.13.0"])
127
- s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
128
- s.add_dependency(%q<thor>, [">= 0.14.6"])
129
- s.add_dependency(%q<active_support>, ["~> 3.0.0"])
109
+ s.add_dependency(%q<rspec>)
110
+ s.add_dependency(%q<page-object>)
111
+ s.add_dependency(%q<thor>)
112
+ s.add_dependency(%q<rdoc>)
113
+ s.add_dependency(%q<bundler>)
114
+ s.add_dependency(%q<jeweler>)
130
115
  end
131
116
  end
132
117
 
@@ -1,4 +1,3 @@
1
- require 'active_support/all' # need be replaced, only required string of active support
2
1
  require 'watir-webdriver'
3
2
  require 'page-object'
4
3
  require 'lazyman/ext/string'
@@ -1,12 +1,27 @@
1
- class String
2
- def lazy_to_hash
3
- hash = { }
4
- return hash if self.empty?
5
- arr = self.split(',').map { |i| i.strip }
6
- arr.each do |key|
7
- hash[key.to_sym] = true
8
- end #each
9
- hash
10
- end
11
-
12
- end
1
+ class String
2
+ def lazy_to_hash
3
+ hash = { }
4
+ return hash if self.empty?
5
+ arr = self.split(',').map { |i| i.strip }
6
+ arr.each do |key|
7
+ hash[key.to_sym] = true
8
+ end #each
9
+ hash
10
+ end
11
+
12
+ def underscore
13
+ return self unless self =~ /[A-Z-]|::/
14
+ word = self.to_s.gsub(/::/, '/')
15
+ word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'}#{$2.downcase}" }
16
+ word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
17
+ word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
18
+ word.tr!("-", "_")
19
+ word.downcase!
20
+ word
21
+ end
22
+
23
+ def acronym_regex
24
+ /(?=a)b/
25
+ end
26
+
27
+ end
@@ -1,3 +1,3 @@
1
- --default-path=./app/cases
2
- --format Lazyman::LazymanFormatter
3
- -r ./config/lazyman_formatter.rb
1
+ --default-path=./app/cases
2
+ --format Lazyman::LazymanFormatter
3
+ -r ./config/lazyman_formatter.rb
@@ -1,16 +1,16 @@
1
- #encoding: utf-8
2
- require File.expand_path 'app/cases/spec_helper'
3
-
4
- describe 'Google example show you how to use lazyman', :google do
5
-
6
- before :all do
7
- @keyword = 'watir-webdriver'
8
- end
9
-
10
- it 'should have correct search result' do
11
- google_page = $navi.goto_google_page
12
- result_page = google_page.search_for @keyword
13
- result_page.first_result.should eq 'Watir WebDriver | the most elegant way to use webdriver with ruby'
14
- end
15
-
16
- end
1
+ #encoding: utf-8
2
+ require File.expand_path 'app/cases/spec_helper'
3
+
4
+ describe 'Google example show you how to use lazyman', :google do
5
+
6
+ before :all do
7
+ @keyword = 'watir-webdriver'
8
+ end
9
+
10
+ it 'should have correct search result' do
11
+ google_page = $navi.goto_google_page
12
+ result_page = google_page.search_for @keyword
13
+ result_page.first_result.should eq 'Watir WebDriver | the most elegant way to use webdriver with ruby'
14
+ end
15
+
16
+ end
@@ -1,11 +1,11 @@
1
- shared_examples 'login' do
2
- it 'should login' do
3
- data = test_data('login_user')
4
- user = data['demo']['name']
5
- password = data['demo']['password']
6
-
7
- login_page = $navi.goto_login_page
8
- my_view_page = login_page.login user, password
9
- my_view_page.report_issue?.should be_true
10
- end
11
- end
1
+ shared_examples 'login' do
2
+ it 'should login' do
3
+ data = test_data('login_user')
4
+ user = data['demo']['name']
5
+ password = data['demo']['password']
6
+
7
+ login_page = $navi.goto_login_page
8
+ my_view_page = login_page.login user, password
9
+ my_view_page.report_issue?.should be_true
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
- lib/**/*.rb
2
- -
3
- README.md
4
- License.txt
5
- Changelog.md
1
+ lib/**/*.rb
2
+ -
3
+ README.md
4
+ License.txt
5
+ Changelog.md
@@ -1,5 +1,5 @@
1
- lib/**/*.rb
2
- -
3
- README.md
4
- License.txt
5
- Changelog.md
1
+ lib/**/*.rb
2
+ -
3
+ README.md
4
+ License.txt
5
+ Changelog.md
@@ -1,6 +1,6 @@
1
- module Menu
2
- include PageObject
3
- link 'main', text: 'Main'
4
- link 'logout', text: 'Logout'
5
- link 'report_issue', text: 'Report Issue'
6
- end
1
+ module Menu
2
+ include PageObject
3
+ link 'main', text: 'Main'
4
+ link 'logout', text: 'Logout'
5
+ link 'report_issue', text: 'Report Issue'
6
+ end
@@ -1,16 +1,16 @@
1
- #encoding: utf-8
2
- class GooglePage < <%= app_name.camelize%>Page
3
- page_url 'www.google.com.hk'
4
-
5
- text_field 'keyword', name: 'q'
6
- button 'search', name: 'btnK'
7
-
8
- def search_for kw
9
- self.keyword = kw
10
- self.keyword_element.send_keys :return
11
- # example show you how to use wait_until_present
12
- @browser.table(id: 'nav').wait_until_present
13
- turn_to GoogleSearchResultPage
14
- end
15
-
16
- end
1
+ #encoding: utf-8
2
+ class GooglePage < <%= app_name.camelize%>Page
3
+ page_url 'www.google.com.hk'
4
+
5
+ text_field 'keyword', name: 'q'
6
+ button 'search', name: 'btnK'
7
+
8
+ def search_for kw
9
+ self.keyword = kw
10
+ self.keyword_element.send_keys :return
11
+ # example show you how to use wait_until_present
12
+ @browser.table(id: 'nav').wait_until_present
13
+ turn_to GoogleSearchResultPage
14
+ end
15
+
16
+ end
@@ -1,4 +1,4 @@
1
- #encoding: utf-8
2
- class GoogleSearchResultPage < <%= app_name.camelize%>Page
3
- h3 'first_result', index: 0
4
- end
1
+ #encoding: utf-8
2
+ class GoogleSearchResultPage < <%= app_name.camelize%>Page
3
+ h3 'first_result', index: 0
4
+ end
@@ -1,5 +1,5 @@
1
- lib/**/*.rb
2
- -
3
- README.md
4
- License.txt
5
- Changelog.md
1
+ lib/**/*.rb
2
+ -
3
+ README.md
4
+ License.txt
5
+ Changelog.md
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env ruby
2
-
3
- spec_helper = File.expand_path(File.join('.', 'app', 'cases', 'spec_helper.rb'))
4
-
5
- setup = File.join(File.dirname(__FILE__), 'setup.rb')
6
-
7
- exec "irb -r rspec -r #{spec_helper} -r #{setup} -r irb/completion --simple-prompt --readline"
1
+ #!/usr/bin/env ruby
2
+
3
+ spec_helper = File.expand_path(File.join('.', 'app', 'cases', 'spec_helper.rb'))
4
+
5
+ setup = File.join(File.dirname(__FILE__), 'setup.rb')
6
+
7
+ exec "irb -r rspec -r #{spec_helper} -r #{setup} -r irb/completion --simple-prompt --readline"
@@ -1,6 +1,6 @@
1
- @ECHO OFF
2
- IF NOT "%~f0" == "~f0" GOTO :WinNT
3
- @"ruby.exe" "" %1 %2 %3 %4 %5 %6 %7 %8 %9
4
- GOTO :EOF
5
- :WinNT
6
- @"ruby.exe" "%~dpn0" %*
1
+ @ECHO OFF
2
+ IF NOT "%~f0" == "~f0" GOTO :WinNT
3
+ @"ruby.exe" "" %1 %2 %3 %4 %5 %6 %7 %8 %9
4
+ GOTO :EOF
5
+ :WinNT
6
+ @"ruby.exe" "%~dpn0" %*
@@ -1,12 +1,12 @@
1
- def test_data file
2
- content = ''
3
- file_path = File.expand_path(File.join('.', 'app', 'test_data', "#{file}.yml"))
4
- raise "Can not find #{file}.yml" unless File.exists?(file_path)
5
- File.open(file_path, 'r') do |handle|
6
- content = handle.read
7
- end
8
- Psych.load ERB.new(content).result(binding)
9
- end
10
- <% require 'active_support/all' %>
11
- $navi = <%= app_name.camelize %>Navigator.new $config
12
-
1
+ def test_data file
2
+ content = ''
3
+ file_path = File.expand_path(File.join('.', 'app', 'test_data', "#{file}.yml"))
4
+ raise "Can not find #{file}.yml" unless File.exists?(file_path)
5
+ File.open(file_path, 'r') do |handle|
6
+ content = handle.read
7
+ end
8
+ Psych.load ERB.new(content).result(binding)
9
+ end
10
+ <% require 'active_support/all' %>
11
+ $navi = <%= app_name.camelize %>Navigator.new $config
12
+
@@ -1,24 +1,24 @@
1
- require 'erb'
2
- require 'rspec/core/formatters/html_formatter'
3
-
4
- module Lazyman
5
- class LazymanFormatter < ::RSpec::Core::Formatters::HtmlFormatter
6
- def initialize(output)
7
- output = File.new(File.expand_path(File.join('.', 'app', 'reports', "#{Time.now.strftime("%Y%m%d_%H%M%S")}.html")), 'w')
8
- super(output)
9
- @printer.class.send(:define_method, 'puts') do |what|
10
- @output.puts what
11
- end #define_method
12
- end
13
-
14
- def example_failed(example)
15
- super(example)
16
- if $navi
17
- failed_url = $navi.url rescue $navi.current_url
18
- @printer.puts "<a target=\"_blank\" href=\"#{failed_url}\">failed url is [#{failed_url}]</a>"
19
- @printer.puts '<br />'
20
- @printer.flush
21
- end #if
22
- end
23
- end #LazymanFormatter
24
- end #Lazyman
1
+ require 'erb'
2
+ require 'rspec/core/formatters/html_formatter'
3
+
4
+ module Lazyman
5
+ class LazymanFormatter < ::RSpec::Core::Formatters::HtmlFormatter
6
+ def initialize(output)
7
+ output = File.new(File.expand_path(File.join('.', 'app', 'reports', "#{Time.now.strftime("%Y%m%d_%H%M%S")}.html")), 'w')
8
+ super(output)
9
+ @printer.class.send(:define_method, 'puts') do |what|
10
+ @output.puts what
11
+ end #define_method
12
+ end
13
+
14
+ def example_failed(example)
15
+ super(example)
16
+ if $navi
17
+ failed_url = $navi.url rescue $navi.current_url
18
+ @printer.puts "<a target=\"_blank\" href=\"#{failed_url}\">failed url is [#{failed_url}]</a>"
19
+ @printer.puts '<br />'
20
+ @printer.flush
21
+ end #if
22
+ end
23
+ end #LazymanFormatter
24
+ end #Lazyman
@@ -1,44 +1,44 @@
1
- require 'spec_helper'
2
-
3
- describe Lazyman::Page do
4
- before :all do
5
- @app_name = 'test'
6
- Lazyman::Initializer.new File.dirname(__FILE__), @app_name
7
- end
8
-
9
- before(:each) do
10
- @browser = mock_watir_browser
11
- end
12
-
13
- def mock_watir_browser
14
- watir_browser = double('watir')
15
- watir_browser.stub!(:is_a?).with(anything()).and_return(false)
16
- watir_browser.stub!(:is_a?).with(Watir::Browser).and_return(true)
17
- watir_browser
18
- end
19
-
20
- it 'method missing' do
21
- @browser.stub :close
22
- @browser.should_receive :close
23
- Lazyman::Page.new(@browser).close
24
- end
25
-
26
- it 'should turn to page' do
27
- p = Lazyman::Page.new(@browser).turn_to TestPage
28
- p.is_a?(TestPage).should be_true
29
- end
30
-
31
- it 'should data driven with hash' do
32
- btn = double();
33
- hash = {:one => 'click', :two => 'ok'}
34
-
35
- p = TestPage.new(@browser)
36
- p.stub(:one).and_return(btn)
37
- p.stub(:two=)
38
- btn.should_receive(:click)
39
- p.should_receive(:one)
40
- p.should_receive(:two=).with('ok')
41
- p.data_driven(hash)
42
- end
43
-
44
- end
1
+ require 'spec_helper'
2
+
3
+ describe Lazyman::Page do
4
+ before :all do
5
+ @app_name = 'test'
6
+ Lazyman::Initializer.new File.dirname(__FILE__), @app_name
7
+ end
8
+
9
+ before(:each) do
10
+ @browser = mock_watir_browser
11
+ end
12
+
13
+ def mock_watir_browser
14
+ watir_browser = double('watir')
15
+ watir_browser.stub(:is_a?).with(anything()).and_return(false)
16
+ watir_browser.stub(:is_a?).with(Watir::Browser).and_return(true)
17
+ watir_browser
18
+ end
19
+
20
+ it 'method missing' do
21
+ @browser.stub :close
22
+ @browser.should_receive :close
23
+ Lazyman::Page.new(@browser).close
24
+ end
25
+
26
+ it 'should turn to page' do
27
+ p = Lazyman::Page.new(@browser).turn_to TestPage
28
+ p.is_a?(TestPage).should be_true
29
+ end
30
+
31
+ it 'should data driven with hash' do
32
+ btn = double();
33
+ hash = {:one => 'click', :two => 'ok'}
34
+
35
+ p = TestPage.new(@browser)
36
+ p.stub(:one).and_return(btn)
37
+ p.stub(:two=)
38
+ btn.should_receive(:click)
39
+ p.should_receive(:one)
40
+ p.should_receive(:two=).with('ok')
41
+ p.data_driven(hash)
42
+ end
43
+
44
+ end
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
2
-
3
- describe String do
4
-
5
- it 'lazy_to_hash should have correct behavor' do
6
- str = 'a, b, c, d'
7
- str.lazy_to_hash.should eq({a: true, b: true, c: true, d: true})
8
- end
9
-
10
- end
1
+ require 'spec_helper'
2
+
3
+ describe String do
4
+
5
+ it 'lazy_to_hash should have correct behavor' do
6
+ str = 'a, b, c, d'
7
+ str.lazy_to_hash.should eq({a: true, b: true, c: true, d: true})
8
+ end
9
+
10
+ end
metadata CHANGED
@@ -1,137 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazyman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
5
- prerelease:
4
+ version: 0.1.14
6
5
  platform: ruby
7
6
  authors:
8
7
  - easonhan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-24 00:00:00.000000000Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &27470544 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 2.13.0
19
+ version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *27470544
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: page-object
27
- requirement: &27470064 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - ">="
31
32
  - !ruby/object:Gem::Version
32
- version: 0.8.6.1
33
+ version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *27470064
36
- - !ruby/object:Gem::Dependency
37
- name: thor
38
- requirement: &27469524 !ruby/object:Gem::Requirement
39
- none: false
36
+ version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ! '>='
38
+ - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: 0.14.6
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: *27469524
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
- name: active_support
49
- requirement: &27469032 !ruby/object:Gem::Requirement
50
- none: false
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
51
44
  requirements:
52
- - - ~>
45
+ - - ">="
53
46
  - !ruby/object:Gem::Version
54
- version: 3.0.0
47
+ version: '0'
55
48
  type: :runtime
56
49
  prerelease: false
57
- version_requirements: *27469032
58
- - !ruby/object:Gem::Dependency
59
- name: rdoc
60
- requirement: &27468624 !ruby/object:Gem::Requirement
61
- none: false
50
+ version_requirements: !ruby/object:Gem::Requirement
62
51
  requirements:
63
- - - ~>
52
+ - - ">="
64
53
  - !ruby/object:Gem::Version
65
- version: '3.12'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *27468624
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: &27468132 !ruby/object:Gem::Requirement
72
- none: false
56
+ name: rdoc
57
+ requirement: !ruby/object:Gem::Requirement
73
58
  requirements:
74
- - - ~>
59
+ - - ">="
75
60
  - !ruby/object:Gem::Version
76
- version: 1.0.0
61
+ version: '0'
77
62
  type: :development
78
63
  prerelease: false
79
- version_requirements: *27468132
80
- - !ruby/object:Gem::Dependency
81
- name: jeweler
82
- requirement: &27467676 !ruby/object:Gem::Requirement
83
- none: false
64
+ version_requirements: !ruby/object:Gem::Requirement
84
65
  requirements:
85
- - - ~>
66
+ - - ">="
86
67
  - !ruby/object:Gem::Version
87
- version: 1.8.4
88
- type: :development
89
- prerelease: false
90
- version_requirements: *27467676
68
+ version: '0'
91
69
  - !ruby/object:Gem::Dependency
92
- name: rspec
93
- requirement: &27467280 !ruby/object:Gem::Requirement
94
- none: false
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
95
72
  requirements:
96
- - - ! '>='
73
+ - - ">="
97
74
  - !ruby/object:Gem::Version
98
- version: 2.13.0
75
+ version: '0'
99
76
  type: :development
100
77
  prerelease: false
101
- version_requirements: *27467280
102
- - !ruby/object:Gem::Dependency
103
- name: page-object
104
- requirement: &27466800 !ruby/object:Gem::Requirement
105
- none: false
78
+ version_requirements: !ruby/object:Gem::Requirement
106
79
  requirements:
107
- - - ! '>='
80
+ - - ">="
108
81
  - !ruby/object:Gem::Version
109
- version: 0.8.6.1
110
- type: :development
111
- prerelease: false
112
- version_requirements: *27466800
82
+ version: '0'
113
83
  - !ruby/object:Gem::Dependency
114
- name: thor
115
- requirement: &27466320 !ruby/object:Gem::Requirement
116
- none: false
84
+ name: jeweler
85
+ requirement: !ruby/object:Gem::Requirement
117
86
  requirements:
118
- - - ! '>='
87
+ - - ">="
119
88
  - !ruby/object:Gem::Version
120
- version: 0.14.6
89
+ version: '0'
121
90
  type: :development
122
91
  prerelease: false
123
- version_requirements: *27466320
124
- - !ruby/object:Gem::Dependency
125
- name: active_support
126
- requirement: &27465948 !ruby/object:Gem::Requirement
127
- none: false
92
+ version_requirements: !ruby/object:Gem::Requirement
128
93
  requirements:
129
- - - ~>
94
+ - - ">="
130
95
  - !ruby/object:Gem::Version
131
- version: 3.0.0
132
- type: :development
133
- prerelease: false
134
- version_requirements: *27465948
96
+ version: '0'
135
97
  description: A test framework using watir-webdriver rspec and page-object
136
98
  email: nbkhic@qq.com
137
99
  executables:
@@ -142,7 +104,7 @@ extra_rdoc_files:
142
104
  - README.md
143
105
  - README.rdoc
144
106
  files:
145
- - .document
107
+ - ".document"
146
108
  - Gemfile
147
109
  - Gemfile.lock
148
110
  - LICENSE.txt
@@ -206,28 +168,24 @@ files:
206
168
  homepage: https://github.com/easonhan007/lazyman
207
169
  licenses:
208
170
  - MIT
171
+ metadata: {}
209
172
  post_install_message:
210
173
  rdoc_options: []
211
174
  require_paths:
212
175
  - lib
213
176
  required_ruby_version: !ruby/object:Gem::Requirement
214
- none: false
215
177
  requirements:
216
- - - ! '>='
178
+ - - ">="
217
179
  - !ruby/object:Gem::Version
218
180
  version: '0'
219
- segments:
220
- - 0
221
- hash: 506620335
222
181
  required_rubygems_version: !ruby/object:Gem::Requirement
223
- none: false
224
182
  requirements:
225
- - - ! '>='
183
+ - - ">="
226
184
  - !ruby/object:Gem::Version
227
185
  version: '0'
228
186
  requirements: []
229
187
  rubyforge_project:
230
- rubygems_version: 1.8.17
188
+ rubygems_version: 2.2.2
231
189
  signing_key:
232
190
  specification_version: 3
233
191
  summary: A simple web automation test framework