bret-watircraft 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,27 @@
1
+ === 0.4.4 / 2009-04-02
2
+
3
+ This release provides a number of new configuration options for managing
4
+ browsers. Detailed instructions are now displayed after creating a new
5
+ project. We've also updated the Rdoc.
6
+
7
+ New Features
8
+
9
+ * Added several new browser configuration options. These are: attach, leave_open
10
+ speed, visible, and bring_to_front. Like "browser" these can be specified
11
+ as env vars, as rake arguments, or in the config.yml file. See config.yml
12
+ file in a new project for exact syntax. Currently all but leave_open only work
13
+ with IE; inapplicable settings will simply be ignored when running with Firefox.
14
+ * Extracted Site#initialize_browser method. This does all the standard
15
+ initialization of the browser as per configuration settings. However, in
16
+ cases where exceptional measures must me taken (e.g. security popups), the
17
+ standard method can now be to overriden or extended.
18
+
19
+ Documentation
20
+
21
+ * Corrected and expanded Rdoc for Page.
22
+ * Detailed instructions are now displayed after you execute the "watircraft"
23
+ command.
24
+
1
25
  === 0.4.3 / 2009-03-31
2
26
 
3
27
  Bug Fixes
data/Manifest.txt CHANGED
@@ -1,4 +1,3 @@
1
- BUGS.txt
2
1
  History.txt
3
2
  Manifest.txt
4
3
  README.rdoc
@@ -73,6 +72,7 @@ app_generators/watircraft/templates/environments.yml.erb
73
72
  app_generators/watircraft/templates/feature_helper.rb
74
73
  app_generators/watircraft/templates/initialize.rb.erb
75
74
  app_generators/watircraft/templates/rakefile.rb
75
+ app_generators/watircraft/templates/readme.txt
76
76
  app_generators/watircraft/templates/script
77
77
  app_generators/watircraft/templates/script/console
78
78
  app_generators/watircraft/templates/script/console.cmd
data/README.rdoc CHANGED
@@ -13,7 +13,8 @@ a place to put things.
13
13
 
14
14
  * Generates a directory structure for your test suite with one command.
15
15
  * Provides page adapters you can customize for your application.
16
- * Configure application URL and browser type (IE, Firefox) in one location.
16
+ * Configure environment URLs and browser type (IE, Firefox) in one location.
17
+ * Supports multiple environments; specify which to test at run time.
17
18
  * Uses templates to create tests and libraries.
18
19
  * Automatically initializes browser for testing.
19
20
  * Provides the glue to ensure your tests can find your libraries. Don't
@@ -129,11 +130,15 @@ examples project on github. Look in the +watircraft+ directory.
129
130
 
130
131
  == QUESTIONS AND FEEDBACK
131
132
 
133
+ Known bugs and road map. You can report bugs and request features here.
134
+ * http://watircraft.lighthouseapp.com/projects/28400-watircraft/overview
135
+
132
136
  Join our mailing list for WatirCraft users.
133
137
  * http://tech.groups.yahoo.com/group/watir-framework
134
138
 
135
139
  The WatirCraft framework is developed by WatirCraft LLC, based on Taza[http://github.com/scudco/taza/wikis].
136
- Please send bug reports, feature requests and other comments to us at feedback@watircraft.com[mailto:feedback@watircraft.com]
140
+ Please send your comments to us at feedback@watircraft.com[mailto:feedback@watircraft.com]
141
+ We love getting your emails.
137
142
 
138
143
  WatirCraft LLC provides training and consulting for Watir, Ruby and the
139
144
  WatirCraft framework.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 3
3
- :major: 0
4
2
  :minor: 4
3
+ :patch: 4
4
+ :major: 0
@@ -1,11 +1,10 @@
1
1
  Description:
2
2
 
3
- Creates a watircraft test project.
4
-
5
- To update an existing project to this version, run this command on the project.
3
+ Creates a watircraft test project. To update an existing project to
4
+ this version, run this command from the base of the project.
6
5
 
7
6
  Examples:
8
7
 
9
- watircraft google # to create a new project (or update a project called google)
10
- watircraft . # to update an existing project
8
+ watircraft google # creates new project called google
9
+ watircraft . # updates current project
11
10
 
@@ -1,3 +1,8 @@
1
- browser: ie
2
- driver: <%= driver %>
3
- site: <%= site %>
1
+ browser: ie
2
+ visible: true
3
+ speed: fast
4
+ attach: false
5
+ bring_to_front: false
6
+ leave_open: false
7
+ driver: <%= driver %>
8
+ site: <%= site %>
@@ -0,0 +1,38 @@
1
+
2
+ How to create a WatirCraft Project
3
+ ==================================
4
+
5
+ 1. DONE - Run the WatirCraft command: watircraft projectname
6
+ 2. Edit config/config.yml to include the base url of your application.
7
+ 3. CD into your new project directory. All of the following commands assume
8
+ that your current directory is the base of your project.
9
+
10
+ WatirCraft allows you to create Rspec tests, Cucumber tests or both.
11
+
12
+ Rspec Tests
13
+
14
+ 4. Create Test: script\generate spec testname
15
+ 5. Edit the file, adding Watir commands where specified.
16
+ 6. Run one test: ruby test\specs\testname_spec.rb
17
+ Or you can just use F5 if using the Scite editor.
18
+ 7. Run all spec-tests: rake spec
19
+
20
+ Cucumber Tests
21
+
22
+ 8. Create Feature. Place your feature-tests in the test\features directory.
23
+ They should follow the standard cucumber format.
24
+ 9. Create Steps File: script\generate steps filename
25
+ 10. Dry Run: cucumber test\features\featurename
26
+ This will create step outlines.
27
+ 11. Paste these step outlines into the step definition templates.
28
+ 12. Add Watir command to these steps to make them work.
29
+ 13. Run one feature: cucumber test\features\featurename
30
+ 14. Run all features: rake features
31
+
32
+ Pages are optional and can be used with either Rspec or Cucumber tests.
33
+
34
+ 15. Create a page: script\generate page pagename
35
+ 16. Pages can be referenced from rspec tests or cucumber steps.
36
+
37
+ Enter "script\generate" to see a complete list of WatirCraft files that
38
+ you can create.
@@ -56,6 +56,8 @@ class WatircraftGenerator < RubiGen::Base
56
56
 
57
57
  m.template "site.rb.erb", "lib/#{@site}.rb", :collision => :skip
58
58
  m.template "environments.yml.erb", "config/environments.yml", :collision => :skip
59
+
60
+ m.readme "readme.txt"
59
61
  end
60
62
  end
61
63
 
@@ -104,7 +106,7 @@ EOS
104
106
  # raw instance variable value.
105
107
  # @author = options[:author]
106
108
  @site = options[:site]
107
- @driver = options[:driver] || :watir
109
+ @driver = options[:driver] || 'watir'
108
110
  end
109
111
 
110
112
  end
data/lib/taza/browser.rb CHANGED
@@ -1,50 +1,67 @@
1
- module Taza
2
- class Browser
3
-
4
- # Create a browser instance depending on configuration. Configuration should be read in via Taza::Settings.config.
5
- #
6
- # Example:
7
- # browser = Taza::Browser.create(Taza::Settings.config)
8
- #
9
- def self.create(params={})
10
- self.send("create_#{params[:driver]}".to_sym,params)
11
- end
12
-
13
- private
14
-
15
- def self.create_watir(params)
16
- require 'watir'
17
- require 'extensions/watir'
18
- if params[:browser] == :ie
19
- require 'watir/ie'
20
- Watir.add_display_value_methods_to Watir
21
- end
22
- if params[:browser] == :firefox
23
- require 'firewatir'
24
- Watir.add_display_value_methods_to FireWatir
25
- end
26
- Watir::Browser.default = params[:browser].to_s
27
- Watir::Browser.new
28
- end
29
-
30
- def self.create_selenium(params)
31
- require 'selenium'
32
- Selenium::SeleniumDriver.new(params[:server_ip],params[:server_port],'*' + params[:browser].to_s,params[:timeout])
33
- end
34
-
35
- def self.create_fake(params)
36
- FakeBrowser.new
37
- end
38
-
39
- end
40
-
41
- class FakeBrowser
42
- def goto(*args)
43
- end
44
- def close
45
- end
46
-
47
- end
48
-
49
- end
50
-
1
+ module Taza
2
+ class Browser
3
+
4
+ class << self
5
+
6
+ # Create a browser instance depending on configuration. Configuration should be read in via Taza::Settings.config.
7
+ #
8
+ # Example:
9
+ # browser = Taza::Browser.create(Taza::Settings.config)
10
+ #
11
+ def create(params={})
12
+ send("create_#{params[:driver]}", params)
13
+ end
14
+
15
+ private
16
+
17
+ def create_watir(params)
18
+ require 'watir'
19
+ require 'extensions/watir'
20
+ Watir::Browser.default = params[:browser]
21
+ case params[:browser]
22
+ when 'ie'
23
+ require 'watir/ie'
24
+ Watir.add_display_value_methods_to Watir
25
+ Watir::IE.set_options(:visible => params[:visible])
26
+ browser = provision_watir_browser params
27
+ browser.speed = params[:speed]
28
+ when 'firefox'
29
+ require 'firewatir'
30
+ Watir.add_display_value_methods_to FireWatir
31
+ browser = provision_watir_browser params
32
+ else
33
+ browser = provision_watir_browser params
34
+ end
35
+
36
+ browser
37
+ end
38
+
39
+ def provision_watir_browser(params)
40
+ if params[:attach] && params[:browser] == 'ie'
41
+ browser = Watir::IE.find(:title, //)
42
+ end
43
+ browser || Watir::Browser.new
44
+ end
45
+
46
+ def create_selenium(params)
47
+ require 'selenium'
48
+ Selenium::SeleniumDriver.new(params[:server_ip],params[:server_port],'*' + params[:browser],params[:timeout])
49
+ end
50
+
51
+ def create_fake(params)
52
+ FakeBrowser.new
53
+ end
54
+ end
55
+
56
+ end
57
+
58
+ class FakeBrowser
59
+ def goto(*args)
60
+ end
61
+ def close
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
data/lib/taza/page.rb CHANGED
@@ -8,7 +8,7 @@ module Taza
8
8
  # Example:
9
9
  # require 'taza'
10
10
  # class HomePage < Taza::Page
11
- # element(:foo) {browser.element_by_xpath('some xpath')}
11
+ # element(:submit) {browser.button(:value, 'Submit')}
12
12
  # filter :title_given, :foo
13
13
  #
14
14
  # def title_given
@@ -16,7 +16,7 @@ module Taza
16
16
  # end
17
17
  # end
18
18
  #
19
- # homepage.foo will return the element specified in the block if the filter returned true
19
+ # <tt>home_page.submit</tt> will return the button specified if the filter returned true
20
20
  class Page
21
21
  attr_accessor :browser, :site
22
22
 
@@ -48,7 +48,8 @@ module Taza
48
48
  # class HomePage < Taza::Page
49
49
  # element(:next_button) {browser.button(:value, 'Next'}
50
50
  # end
51
- # home_page.next_button.click
51
+ #
52
+ # home_page.next_button.click
52
53
  def element(name, &block)
53
54
  name = name.to_s.computerize.to_sym
54
55
  elements[name] = block
@@ -61,24 +62,18 @@ module Taza
61
62
  # field(:name) {browser.text_field(:name, 'user_name')}
62
63
  # end
63
64
  #
64
- # home_page.name_field # returns the text_field element
65
- # home_page.name_field.exists?
66
- # home_page.name = "Fred" # calls the #set method on the text_field
67
- # home_page.name # returns the current value (display_value) of the text_field
65
+ # home_page.name_field # returns the text element
66
+ # home_page.name_field.exists?
67
+ # home_page.name = "Fred" # sets the text element (A)
68
+ # home_page.name # returns the value of the text element (B)
68
69
  #
69
- # The following Watir elements provide both #set and #display_value methods
70
+ # The following Watir elements provide both #set (A) and #display_value (B) methods
70
71
  # text_field (both text boxes and text areas)
71
- # hidden
72
72
  # file_field
73
73
  # select_list
74
74
  # checkbox
75
- # (radios are the obvious item missing from this list -- we're working on it.)
76
75
  #
77
- # The following Watir elements provide #display_value methods (but not #set methods).
78
- # button
79
- # cell
80
- # hidden
81
- # all non-control elements, including divs, spans and most other elements.
76
+ # Most other Watir elements provide #display_value (B) methods only.
82
77
  def field(name, suffix='field', &block)
83
78
  name = name.to_s.computerize.to_sym
84
79
  fields << name
@@ -136,6 +131,7 @@ module Taza
136
131
  # field(:description) {@row.cell(:index, 2)}
137
132
  # end
138
133
  # field(:total) {@browser.cell(:id, 'totalcell')}
134
+ # end
139
135
  #
140
136
  # Example usage
141
137
  #
data/lib/taza/settings.rb CHANGED
@@ -2,79 +2,103 @@ require 'activesupport'
2
2
 
3
3
  module Taza
4
4
  class Settings
5
- # The config settings from the site.yml and config.yml files.
6
- # ENV variables will override the settings.
7
- #
8
- # Example:
9
- # Taza::Settings.config('google')
10
- def self.config(site_name=nil)
11
- env_settings = {}
12
- keys = %w(browser driver timeout server_ip server_port)
13
- keys.each do |key|
14
- env_settings[key.to_sym] = ENV[key.upcase] if ENV[key.upcase]
5
+ class << self
6
+ # The config settings from the site.yml and config.yml files.
7
+ # ENV variables will override the settings.
8
+ #
9
+ # Example:
10
+ # Taza::Settings.config('google')
11
+ def config(site_name=nil)
12
+ keys = %w(browser driver timeout server_ip server_port visible speed attach leave_open bring_to_front)
13
+ default_settings = {
14
+ :browser => 'firefox',
15
+ :driver => 'watir',
16
+ :visible => true,
17
+ :speed => 'fast',
18
+ :attach => false,
19
+ :bring_to_front => false,
20
+ :leave_open => false,
21
+ }
22
+
23
+ env_settings = {}
24
+ keys.each do |key|
25
+ env_settings[key.to_sym] = ENV[key.upcase] if ENV[key.upcase]
26
+ end
27
+
28
+ # Because of the way #merge works, the settings at the bottom of the list
29
+ # trump those at the top.
30
+ settings = environment_settings.merge(
31
+ default_settings.merge(
32
+ config_file.merge(
33
+ env_settings)))
34
+
35
+ settings[:browser] = settings[:browser].to_s
36
+ settings[:driver] = settings[:driver].to_s
37
+ settings[:speed] = settings[:speed].to_sym
38
+ settings[:visible] = to_bool(settings[:visible])
39
+ settings[:leave_open] = to_bool(settings[:leave_open])
40
+ settings[:attach] = to_bool(settings[:attach])
41
+ settings[:bring_to_front] = to_bool(settings[:bring_to_front])
42
+ settings
43
+ end
44
+
45
+ # Returns a hash corresponding to the project config file.
46
+ def config_file
47
+ if File.exists?(config_file_path)
48
+ hash = YAML.load_file(config_file_path)
49
+ else
50
+ hash = {}
51
+ end
52
+ convert_string_keys_to_symbols hash
53
+ end
54
+
55
+ def config_file_path # :nodoc:
56
+ File.join(path, 'config', 'config.yml')
15
57
  end
16
58
 
17
- default_settings = {:browser => :firefox, :driver => :watir}
59
+ # Returns a hash for the currently specified test environment
60
+ def environment_settings # :nodoc:
61
+ file = File.join(path, environment_file)
62
+ hash_of_hashes = YAML.load_file(file)
63
+ unless hash_of_hashes.has_key? environment
64
+ raise "Environment #{environment} not found in #{file}"
65
+ end
66
+ convert_string_keys_to_symbols hash_of_hashes[environment]
67
+ end
18
68
 
19
- # Because of the way #merge works, the settings at the bottom of the list
20
- # trump those at the top.
21
- settings = environment_settings.merge(
22
- default_settings.merge(
23
- config_file.merge(
24
- env_settings)))
25
-
26
- settings[:browser] = settings[:browser].to_sym
27
- settings[:driver] = settings[:driver].to_sym
28
- settings
29
- end
30
-
31
- # Returns a hash corresponding to the project config file.
32
- def self.config_file
33
- if File.exists?(config_file_path)
34
- hash = YAML.load_file(config_file_path)
35
- else
36
- hash = {}
69
+ @@root = nil
70
+
71
+ def path # :nodoc:
72
+ @@root || APP_ROOT
37
73
  end
38
- self.convert_string_keys_to_symbols hash
39
- end
40
-
41
- def self.config_file_path # :nodoc:
42
- File.join(path, 'config', 'config.yml')
43
- end
44
-
45
- # Returns a hash for the currently specified test environment
46
- def self.environment_settings # :nodoc:
47
- file = File.join(path, environment_file)
48
- hash_of_hashes = YAML.load_file(file)
49
- unless hash_of_hashes.has_key? environment
50
- raise "Environment #{environment} not found in #{file}"
74
+
75
+ def path= path
76
+ @@root = path
51
77
  end
52
- convert_string_keys_to_symbols hash_of_hashes[environment]
53
- end
54
-
55
- @@root = nil
56
-
57
- def self.path # :nodoc:
58
- @@root || APP_ROOT
59
- end
60
-
61
- def self.path= path
62
- @@root = path
63
- end
64
-
65
- def self.environment
66
- ENV['ENVIRONMENT'] || 'test'
67
- end
68
-
69
- def self.convert_string_keys_to_symbols hash
70
- returning Hash.new do |new_hash|
71
- hash.each_pair {|k, v| new_hash[k.to_sym] = v}
78
+
79
+ def environment
80
+ ENV['ENVIRONMENT'] || 'test'
81
+ end
82
+
83
+ def convert_string_keys_to_symbols hash
84
+ returning Hash.new do |new_hash|
85
+ hash.each_pair {|k, v| new_hash[k.to_sym] = v}
86
+ end
87
+ end
88
+
89
+ def to_bool value
90
+ case value
91
+ when true, /true/i
92
+ true
93
+ else
94
+ false
95
+ end
96
+ end
97
+
98
+ private
99
+ def environment_file
100
+ 'config/environments.yml'
72
101
  end
73
- end
74
-
75
- private
76
- def self.environment_file
77
- 'config/environments.yml'
78
102
  end
79
103
  end
80
104
  end
data/lib/taza/site.rb CHANGED
@@ -81,23 +81,29 @@ module Taza
81
81
 
82
82
  define_flows
83
83
 
84
- if params[:browser]
85
- @browser = params[:browser]
86
- else
87
- @browser = Browser.create(config)
88
- @i_created_browser = true
89
- end
90
-
91
84
  page_loader = PageLoader.new(@module_name, pages_path)
92
85
  @pages = page_loader.page_names
93
86
  @methods_module = page_loader.page_methods
94
87
  @methods_module.send(:include, Methods)
95
88
  self.extend(@methods_module)
96
-
97
- @browser.goto origin
89
+
90
+ @browser = params[:browser]
91
+ initialize_browser
98
92
 
99
93
  execute_block_and_close_browser(&block) if block_given?
100
94
  end
95
+
96
+ # Initializes browser based on configuration settings.
97
+ def initialize_browser
98
+ if @browser
99
+ @leave_open = true
100
+ else
101
+ @browser = Browser.create(config)
102
+ end
103
+ @browser.goto origin
104
+ bring_to_front_if_appropriate
105
+ @leave_open ||= config[:leave_open]
106
+ end
101
107
 
102
108
  def config
103
109
  Settings.config(@class_name)
@@ -108,6 +114,12 @@ module Taza
108
114
  config[:url]
109
115
  end
110
116
 
117
+ def bring_to_front_if_appropriate
118
+ return unless config[:bring_to_front]
119
+ return unless config[:browser] == 'ie'
120
+ @browser.bring_to_front
121
+ end
122
+
111
123
  def execute_block_and_close_browser
112
124
  begin
113
125
  yield self
@@ -131,7 +143,7 @@ module Taza
131
143
  "" # so basically rcov has a bug where it would insist this block is uncovered when empty
132
144
  end
133
145
  begin
134
- @browser.close if @i_created_browser
146
+ @browser.close unless @leave_open
135
147
  ensure
136
148
  raise before_browser_closes_block_exception if before_browser_closes_block_exception
137
149
  end
@@ -1,3 +1,3 @@
1
1
  # This file is autogenerated. Do not edit.
2
2
  # Use 'rake version.rb' to update.
3
- module WatirCraft; VERSION = '0.4.3'; end
3
+ module WatirCraft; VERSION = '0.4.4'; end
data/spec/browser_spec.rb CHANGED
@@ -25,21 +25,21 @@ describe Taza::Browser do
25
25
  end
26
26
 
27
27
  it "should raise unknown browser error for unsupported watir browsers" do
28
- lambda { Taza::Browser.create(:browser => :foo_browser_9000,:driver => :watir) }.should raise_error(StandardError)
28
+ lambda { Taza::Browser.create(:browser => 'foo_browser_9000', :driver => 'watir') }.should raise_error(StandardError)
29
29
  end
30
30
 
31
31
  it "should use params browser type when creating selenium" do
32
- browser_type = :opera
32
+ browser_type = 'opera'
33
33
  Selenium::SeleniumDriver.expects(:new).with(anything,anything,'*opera',anything)
34
- Taza::Browser.create(:browser => browser_type, :driver => :selenium)
34
+ Taza::Browser.create(:browser => browser_type, :driver => 'selenium')
35
35
  end
36
36
 
37
37
  it "should raise selenium unsupported browser error" do
38
- Taza::Browser.create(:browser => :foo, :driver => :selenium)
38
+ Taza::Browser.create(:browser => 'foo', :driver => 'selenium')
39
39
  end
40
40
 
41
41
  it "should be able to create a selenium instance" do
42
- browser = Taza::Browser.create(:browser => :firefox, :driver => :selenium)
42
+ browser = Taza::Browser.create(:browser => 'firefox', :driver => 'selenium')
43
43
  browser.should be_a_kind_of(Selenium::SeleniumDriver)
44
44
  end
45
45
 
@@ -62,7 +62,7 @@ describe Taza::Browser do
62
62
 
63
63
  # a test of a stub for testing the test harness of our tests
64
64
  it "should provide a fake browser, so we can test our test harness" do
65
- Taza::Browser.create(:driver => :fake).should be_a(Taza::FakeBrowser)
65
+ Taza::Browser.create(:driver => 'fake').should be_a(Taza::FakeBrowser)
66
66
  end
67
67
 
68
68
  end
@@ -86,7 +86,7 @@ describe "Project Generator" do
86
86
  generate_project
87
87
  Taza::Settings.stubs(:path).returns(APP_ROOT)
88
88
  ENV['ENVIRONMENT'] = 'test'
89
- Taza::Settings.config[:driver].should == :watir
89
+ Taza::Settings.config[:driver].should == 'watir'
90
90
  end
91
91
 
92
92
  it "should allow a site name to be specified" do
@@ -100,7 +100,7 @@ describe "Project Generator" do
100
100
  generate_project ['--driver=nine_iron']
101
101
  Taza::Settings.stubs(:path).returns(APP_ROOT)
102
102
  ENV['ENVIRONMENT'] = 'test'
103
- Taza::Settings.config[:driver].should == :nine_iron
103
+ Taza::Settings.config[:driver].should == 'nine_iron'
104
104
  end
105
105
 
106
106
  it "should generate a script/console" do
@@ -13,19 +13,19 @@ describe Taza::Settings do
13
13
  it "should use environment variable for browser settings" do
14
14
  Taza::Settings.stubs(:path).returns("spec/sandbox")
15
15
  ENV['BROWSER'] = 'foo'
16
- Taza::Settings.config('SiteName')[:browser].should eql(:foo)
16
+ Taza::Settings.config('SiteName')[:browser].should eql('foo')
17
17
  end
18
18
 
19
19
  it "should use environment variable for driver settings" do
20
20
  Taza::Settings.stubs(:path).returns("spec/sandbox")
21
21
  ENV['DRIVER'] = 'bar'
22
- Taza::Settings.config('SiteName')[:driver].should eql(:bar)
22
+ Taza::Settings.config('SiteName')[:driver].should eql('bar')
23
23
  end
24
24
 
25
25
  it "should provide default values if no config file or environment settings provided" do
26
26
  Taza::Settings.stubs(:path).returns("spec/sandbox")
27
- Taza::Settings.config('SiteName')[:driver].should eql(:watir)
28
- Taza::Settings.config('SiteName')[:browser].should eql(:firefox)
27
+ Taza::Settings.config('SiteName')[:driver].should eql('watir')
28
+ Taza::Settings.config('SiteName')[:browser].should eql('firefox')
29
29
  end
30
30
 
31
31
  it "should be able to load the site yml" do
@@ -41,21 +41,21 @@ describe Taza::Settings do
41
41
 
42
42
  it "should use the config file's variable for browser settings if no environment variable is set" do
43
43
  Taza::Settings.stubs(:path).returns("spec/sandbox")
44
- Taza::Settings.expects(:config_file).returns({:browser => :fu})
45
- Taza::Settings.config('SiteName')[:browser].should eql(:fu)
44
+ Taza::Settings.expects(:config_file).returns({:browser => 'fu'})
45
+ Taza::Settings.config('SiteName')[:browser].should eql('fu')
46
46
  end
47
47
 
48
48
  it "should use the config file's variable for driver settings if no environment variable is set" do
49
49
  Taza::Settings.stubs(:path).returns("spec/sandbox")
50
- Taza::Settings.stubs(:config_file).returns({:driver => :fun})
51
- Taza::Settings.config('SiteName')[:driver].should eql(:fun)
50
+ Taza::Settings.stubs(:config_file).returns({:driver => 'fun'})
51
+ Taza::Settings.config('SiteName')[:driver].should eql('fun')
52
52
  end
53
53
 
54
54
  it "should use the ENV variables if specified instead of config files" do
55
55
  ENV['BROWSER'] = 'opera'
56
- Taza::Settings.expects(:config_file).returns({:browser => :fu})
56
+ Taza::Settings.expects(:config_file).returns({:browser => 'fu'})
57
57
  Taza::Settings.stubs(:path).returns("spec/sandbox")
58
- Taza::Settings.config('SiteName')[:browser].should eql(:opera)
58
+ Taza::Settings.config('SiteName')[:browser].should eql('opera')
59
59
  end
60
60
 
61
61
  it "should use the correct config file" do
@@ -81,7 +81,7 @@ describe Taza::Settings do
81
81
  it "setting keys can be specified as strings (i.e. without a colon) in the config file" do
82
82
  Taza::Settings.stubs(:config_file_path).returns("spec/sandbox/config/simpler.yml")
83
83
  Taza::Settings.stubs(:path).returns("spec/sandbox")
84
- Taza::Settings.config('SiteName')[:browser].should eql(:opera)
84
+ Taza::Settings.config('SiteName')[:browser].should eql('opera')
85
85
  end
86
86
 
87
87
  it "setting keys can be specified as strings (i.e. without a colon) in the config file" do
@@ -91,13 +91,20 @@ describe Taza::Settings do
91
91
  end
92
92
 
93
93
  it "should be able to convert string keys to symbol keys" do
94
- result = Taza::Settings.convert_string_keys_to_symbols 'browser' => :foo
95
- result.should == {:browser => :foo}
94
+ result = Taza::Settings.convert_string_keys_to_symbols 'browser' => 'foo'
95
+ result.should == {:browser => 'foo'}
96
96
  end
97
97
 
98
98
  it "should provide an empty hash when the config file doesn't exist" do
99
99
  Taza::Settings.stubs(:config_file_path).returns('spec/sandbox/config/no_such_file.yml')
100
100
  Taza::Settings.config_file.should == {}
101
101
  end
102
+
103
+ it "should parse true/false values" do
104
+ Taza::Settings.to_bool('true').should == true
105
+ Taza::Settings.to_bool('True').should == true
106
+ Taza::Settings.to_bool('false').should == false
107
+ Taza::Settings.to_bool(nil).should == false
108
+ end
102
109
 
103
110
  end
data/spec/site_spec.rb CHANGED
@@ -246,4 +246,24 @@ describe do
246
246
  @context = @site.execution_context
247
247
  end
248
248
  end
249
+
250
+ describe Taza::Site do
251
+ it_should_behave_like "an execution context"
252
+ before do
253
+ @context = @site
254
+ end
255
+
256
+ it "should call the initialize method" do
257
+
258
+ class SubClass < Taza::Site
259
+ def initialize_browser
260
+ @browser = 'provided'
261
+ end
262
+ end
263
+
264
+ SubClass.new.browser.should == 'provided'
265
+ end
266
+
267
+
268
+ end
249
269
  end
data/watircraft.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{watircraft}
5
- s.version = "0.4.3"
5
+ s.version = "0.4.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Bret Pettichord", "Jim Matthews", "Charley Baker", "Adam Anderson"]
9
- s.date = %q{2009-03-31}
9
+ s.date = %q{2009-04-03}
10
10
  s.default_executable = %q{watircraft}
11
11
  s.description = %q{WatirCraft is a framework for testing web apps.}
12
12
  s.email = %q{bret@pettichord.com}
13
13
  s.executables = ["watircraft"]
14
14
  s.extra_rdoc_files = ["History.txt", "README.rdoc"]
15
- s.files = ["BUGS.txt", "History.txt", "Manifest.txt", "README.rdoc", "VERSION.yml", "watircraft.gemspec", "bin/watircraft", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/extensions/watir.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "lib/watircraft", "lib/watircraft/generator_helper.rb", "lib/watircraft/table.rb", "lib/watircraft/version.rb", "lib/watircraft.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fake_table.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_spec.rb", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/environments.yml", "spec/sandbox/config/simpler.yml", "spec/sandbox/config/simpler_site.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/users.yml", "spec/sandbox/flows", "spec/sandbox/flows/batman.rb", "spec/sandbox/flows/robin.rb", "spec/sandbox/pages", "spec/sandbox/pages/foo", "spec/sandbox/pages/foo/bar_page.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/site_spec.rb", "spec/spec_generator_helper.rb", "spec/spec_generator_spec.rb", "spec/spec_helper.rb", "spec/steps_generator_spec.rb", "spec/string_spec.rb", "spec/table_spec.rb", "spec/taza_spec.rb", "spec/watircraft_bin_spec.rb", "spec/watir_spec.rb", "app_generators/watircraft", "app_generators/watircraft/templates", "app_generators/watircraft/templates/config.yml.erb", "app_generators/watircraft/templates/environments.yml.erb", "app_generators/watircraft/templates/feature_helper.rb", "app_generators/watircraft/templates/initialize.rb.erb", "app_generators/watircraft/templates/rakefile.rb", "app_generators/watircraft/templates/script", "app_generators/watircraft/templates/script/console", "app_generators/watircraft/templates/script/console.cmd", "app_generators/watircraft/templates/site.rb.erb", "app_generators/watircraft/templates/site_start.rb.erb", "app_generators/watircraft/templates/spec_helper.rb", "app_generators/watircraft/templates/spec_initialize.rb", "app_generators/watircraft/templates/world.rb", "app_generators/watircraft/USAGE", "app_generators/watircraft/watircraft_generator.rb", "watircraft_generators/page", "watircraft_generators/page/page_generator.rb", "watircraft_generators/page/templates", "watircraft_generators/page/templates/page.rb.erb", "watircraft_generators/page/USAGE", "watircraft_generators/spec", "watircraft_generators/spec/spec_generator.rb", "watircraft_generators/spec/templates", "watircraft_generators/spec/templates/spec.rb.erb", "watircraft_generators/spec/USAGE", "watircraft_generators/steps", "watircraft_generators/steps/steps_generator.rb", "watircraft_generators/steps/templates", "watircraft_generators/steps/templates/steps.rb.erb", "watircraft_generators/steps/USAGE"]
15
+ s.files = ["History.txt", "Manifest.txt", "README.rdoc", "VERSION.yml", "watircraft.gemspec", "bin/watircraft", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/extensions/watir.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "lib/watircraft", "lib/watircraft/generator_helper.rb", "lib/watircraft/table.rb", "lib/watircraft/version.rb", "lib/watircraft.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fake_table.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_spec.rb", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/environments.yml", "spec/sandbox/config/simpler.yml", "spec/sandbox/config/simpler_site.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/users.yml", "spec/sandbox/flows", "spec/sandbox/flows/batman.rb", "spec/sandbox/flows/robin.rb", "spec/sandbox/pages", "spec/sandbox/pages/foo", "spec/sandbox/pages/foo/bar_page.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/site_spec.rb", "spec/spec_generator_helper.rb", "spec/spec_generator_spec.rb", "spec/spec_helper.rb", "spec/steps_generator_spec.rb", "spec/string_spec.rb", "spec/table_spec.rb", "spec/taza_spec.rb", "spec/watircraft_bin_spec.rb", "spec/watir_spec.rb", "app_generators/watircraft", "app_generators/watircraft/templates", "app_generators/watircraft/templates/config.yml.erb", "app_generators/watircraft/templates/environments.yml.erb", "app_generators/watircraft/templates/feature_helper.rb", "app_generators/watircraft/templates/initialize.rb.erb", "app_generators/watircraft/templates/rakefile.rb", "app_generators/watircraft/templates/readme.txt", "app_generators/watircraft/templates/script", "app_generators/watircraft/templates/script/console", "app_generators/watircraft/templates/script/console.cmd", "app_generators/watircraft/templates/site.rb.erb", "app_generators/watircraft/templates/site_start.rb.erb", "app_generators/watircraft/templates/spec_helper.rb", "app_generators/watircraft/templates/spec_initialize.rb", "app_generators/watircraft/templates/world.rb", "app_generators/watircraft/USAGE", "app_generators/watircraft/watircraft_generator.rb", "watircraft_generators/page", "watircraft_generators/page/page_generator.rb", "watircraft_generators/page/templates", "watircraft_generators/page/templates/page.rb.erb", "watircraft_generators/page/USAGE", "watircraft_generators/spec", "watircraft_generators/spec/spec_generator.rb", "watircraft_generators/spec/templates", "watircraft_generators/spec/templates/spec.rb.erb", "watircraft_generators/spec/USAGE", "watircraft_generators/steps", "watircraft_generators/steps/steps_generator.rb", "watircraft_generators/steps/templates", "watircraft_generators/steps/templates/steps.rb.erb", "watircraft_generators/steps/USAGE"]
16
16
  s.has_rdoc = true
17
17
  s.homepage = %q{http://github.com/bret/watircraft/tree/master}
18
18
  s.rdoc_options = ["--main", "README.rdoc"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bret-watircraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bret Pettichord
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-03-31 00:00:00 -07:00
15
+ date: 2009-04-03 00:00:00 -07:00
16
16
  default_executable: watircraft
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -85,7 +85,6 @@ extra_rdoc_files:
85
85
  - History.txt
86
86
  - README.rdoc
87
87
  files:
88
- - BUGS.txt
89
88
  - History.txt
90
89
  - Manifest.txt
91
90
  - README.rdoc
@@ -160,6 +159,7 @@ files:
160
159
  - app_generators/watircraft/templates/feature_helper.rb
161
160
  - app_generators/watircraft/templates/initialize.rb.erb
162
161
  - app_generators/watircraft/templates/rakefile.rb
162
+ - app_generators/watircraft/templates/readme.txt
163
163
  - app_generators/watircraft/templates/script
164
164
  - app_generators/watircraft/templates/script/console
165
165
  - app_generators/watircraft/templates/script/console.cmd
data/BUGS.txt DELETED
@@ -1,6 +0,0 @@
1
- Known Bugs
2
-
3
- * Can't install on mac. (This used to work.)
4
- * Page fields do not support Radio lists. Workaround: use elements.
5
-
6
-