taza 0.8.7 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +5 -0
  2. data/.rvmrc +49 -0
  3. data/Gemfile +4 -0
  4. data/History.txt +7 -0
  5. data/README +1 -3
  6. data/Rakefile +5 -0
  7. data/TODO +22 -0
  8. data/bin/taza +0 -0
  9. data/generators/flow/flow_generator.rb +1 -1
  10. data/generators/page/page_generator.rb +1 -1
  11. data/generators/partial/partial_generator.rb +1 -1
  12. data/generators/site/site_generator.rb +1 -1
  13. data/lib/app_generators/taza/taza_generator.rb +1 -1
  14. data/lib/app_generators/taza/templates/rakefile.rb.erb +5 -4
  15. data/lib/app_generators/taza/templates/spec_helper.rb.erb +3 -3
  16. data/lib/extensions/object.rb +0 -27
  17. data/lib/extensions/string.rb +13 -2
  18. data/lib/formatters/failing_examples_formatter.rb +8 -0
  19. data/lib/taza.rb +3 -1
  20. data/lib/taza.rb.backup +24 -0
  21. data/lib/taza/browser.rb +10 -5
  22. data/lib/taza/entity.rb +2 -2
  23. data/lib/taza/fixtures.rb +9 -5
  24. data/lib/taza/options.rb +0 -0
  25. data/lib/taza/settings.rb +1 -1
  26. data/lib/taza/site.rb +0 -2
  27. data/lib/taza/tasks.rb +4 -9
  28. data/lib/taza/version.rb +3 -0
  29. data/spec/array_spec.rb +4 -4
  30. data/spec/browser_spec.rb +9 -36
  31. data/spec/entity_spec.rb +2 -2
  32. data/spec/fixture_spec.rb +3 -3
  33. data/spec/fixtures_spec.rb +12 -11
  34. data/spec/flow_generator_spec.rb +1 -4
  35. data/spec/hash_spec.rb +1 -1
  36. data/spec/page_generator_spec.rb +2 -2
  37. data/spec/page_module_spec.rb +2 -2
  38. data/spec/page_spec.rb +9 -9
  39. data/spec/partial_generator_spec.rb +1 -1
  40. data/spec/platform/windows/browser_win.rb +47 -0
  41. data/spec/project_generator_spec.rb +1 -15
  42. data/spec/sandbox/fixtures/foo_site/bars.yml +0 -0
  43. data/spec/sandbox/fixtures/foos.yml +0 -0
  44. data/spec/sandbox/pages/foo/bay.rb +0 -0
  45. data/spec/sandbox/pages/foo/baz.rb +0 -0
  46. data/spec/settings_spec.rb +1 -1
  47. data/spec/site_fixtures_spec.rb +2 -5
  48. data/spec/site_generator_spec.rb +3 -3
  49. data/spec/site_spec.rb +6 -6
  50. data/spec/spec_helper.rb +9 -14
  51. data/spec/string_spec.rb +5 -1
  52. data/spec/taza_bin_spec.rb +1 -1
  53. data/spec/taza_tasks_spec.rb +6 -6
  54. data/taza.gemspec +31 -46
  55. metadata +170 -117
  56. data/VERSION.yml +0 -4
  57. data/spec/object_spec.rb +0 -29
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .idea/
data/.rvmrc ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ree-1.8.7-2011.03@taza"
8
+
9
+ #
10
+ # First we attempt to load the desired environment directly from the environment
11
+ # file. This is very fast and efficicent compared to running through the entire
12
+ # CLI and selector. If you want feedback on which environment was used then
13
+ # insert the word 'use' after --create as this triggers verbose mode.
14
+ #
15
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
16
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
17
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
18
+
19
+ [[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use"
20
+ else
21
+ # If the environment file has not yet been created, use the RVM CLI to select.
22
+ rvm --create "$environment_id"
23
+ fi
24
+
25
+ #
26
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
27
+ # it be automatically loaded. Uncomment the following and adjust the filename if
28
+ # necessary.
29
+ #
30
+ # filename=".gems"
31
+ # if [[ -s "$filename" ]] ; then
32
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
33
+ # fi
34
+
35
+ #
36
+ # If you use bundler and would like to run bundle each time you enter the
37
+ # directory, you can uncomment the following code.
38
+ #
39
+ # # Ensure that Bundler is installed. Install it if it is not.
40
+ # if ! command -v bundle >/dev/null; then
41
+ # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
42
+ # gem install bundler
43
+ # fi
44
+ #
45
+ # # Bundle while reducing excess noise.
46
+ # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
47
+ # bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
48
+ #
49
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in taza.gemspec
4
+ gemspec
@@ -1,3 +1,10 @@
1
+ === 0.9.0
2
+
3
+ * Watir-Webdriver support (use driver watir_webdriver)
4
+ * Ruby 1.9 support
5
+ * RSpec 2.x support
6
+ * Some minor bugfixes
7
+
1
8
  === 0.8.7
2
9
 
3
10
  * Added script/console Utility
data/README CHANGED
@@ -39,15 +39,13 @@ Here's an example for starting a project around the Google sites
39
39
  $ ./script/generate site google
40
40
  $ ./script/generate page home_page google
41
41
  $ ./script/generate flow search google
42
- $ rake spec:functional:google
42
+ $ rake spec:isolation:google
43
43
 
44
44
  That will generate an RSpec HTML report at artifacts/functional/google/index.html
45
45
 
46
46
 
47
47
  == REQUIREMENTS:
48
48
 
49
- * taglob
50
-
51
49
  == INSTALL:
52
50
 
53
51
  * sudo gem install taza
@@ -0,0 +1,5 @@
1
+ require 'bundler/setup'
2
+ require 'rspec/core/rake_task'
3
+ Bundler::GemHelper.install_tasks
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
data/TODO ADDED
@@ -0,0 +1,22 @@
1
+ Done:
2
+ + Tagging test's (resolution: taglob)
3
+ + sites and pages (resolution: Taza::Site)
4
+ + generators for rakefile (resolution: uhh we made one?)
5
+ + running tests by tag (resolution: ???)
6
+ + gem server (resolution: taylor spiked this out)
7
+ + build artifact of a video of a test running (resolution: we have two stories around this now)
8
+ + test framework choices - what are we going to use and why we are using the one we are (resolution: rspec)
9
+ + accessing the actual browser object (who creates it, who tears it down, etc)
10
+ + block teardown of browser if yield is given for site
11
+ + gem dependencies via hoe.(taglob,rake,rspec,mocha)
12
+ + getting settings of a site: ex ECOM.settings delgates to taza::settings.site_file(ecom)
13
+ + mocks
14
+
15
+ taza
16
+ - get rid of all the dumb ^M windows line endings
17
+ - url resolving
18
+ - ability to change yaml for a site
19
+ - ability to run integration tests for just a site
20
+ - clean all the config tests
21
+ - add test/spec support for generators
22
+ - add test/spec support for fixtures
data/bin/taza CHANGED
File without changes
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rubigen'
3
- require 'activesupport'
3
+ require 'active_support'
4
4
 
5
5
  class FlowGenerator < RubiGen::Base
6
6
  default_options :author => nil
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rubigen'
3
- require 'activesupport'
3
+ require 'active_support'
4
4
 
5
5
  class PageGenerator < RubiGen::Base
6
6
  default_options :author => nil
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rubigen'
3
- require 'activesupport'
3
+ require 'active_support'
4
4
 
5
5
  class PartialGenerator < RubiGen::Base
6
6
  default_options :author => nil
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rubigen'
3
- require 'activesupport'
3
+ require 'active_support'
4
4
 
5
5
  class SiteGenerator < RubiGen::Base
6
6
  default_options :author => nil
@@ -24,7 +24,7 @@ class TazaGenerator < RubiGen::Base
24
24
  m.template "spec_helper.rb.erb", File.join("spec","spec_helper.rb")
25
25
  m.dependency "install_rubigen_scripts", [destination_root, 'taza'],
26
26
  :shebang => options[:shebang], :collision => :force
27
- m.template "console.erb", File.join("script","console")
27
+ m.template "console.erb", File.join("script","console"), {:chmod => 0755}
28
28
  m.template "console.cmd.erb", File.join("script","console.cmd")
29
29
  end
30
30
  end
@@ -3,8 +3,9 @@ require 'rubygems'
3
3
  require 'taza/tasks'
4
4
 
5
5
  Taza::Rake::Tasks.new do |t|
6
- file_hole = "artifacts/#{Time.now.to_i}"
7
- t.spec_opts = ["--format html:#{file_hole}/index.html",
8
- "--format p",
9
- "--format failing_examples:#{file_hole}/failing_examples.txt"]
6
+ file_hole = FileUtils.mkdir_p "artifacts/#{Time.now.to_i}"
7
+ t.spec_opts = ["--require taza",
8
+ "--format html --out #{file_hole}/index.html",
9
+ "--format p" ,
10
+ "--format FailingExamplesFormatter --out #{file_hole}/failing_examples.txt"]
10
11
  end
@@ -1,11 +1,11 @@
1
1
  ENV['TAZA_ENV'] = "isolation" if ENV['TAZA_ENV'].nil?
2
2
  require 'rubygems'
3
- require 'spec'
3
+ require 'rspec'
4
4
  require 'mocha'
5
5
 
6
6
  lib_path = File.expand_path("#{File.dirname(__FILE__)}/../lib/sites")
7
7
  $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
8
8
 
9
- Spec::Runner.configure do |config|
9
+ RSpec.configure do |config|
10
10
  config.mock_with :mocha
11
- end
11
+ end
@@ -1,31 +1,4 @@
1
1
  # instance_exec comes with >1.8.7 thankfully
2
- if VERSION <= '1.8.6'
3
- class Object
4
- def metaclass
5
- class << self; self; end
6
- end
7
-
8
- module InstanceExecHelper; end
9
- include InstanceExecHelper
10
- # instance_exec method evaluates a block of code relative to the specified object, with parameters whom come from outside the object.
11
- def instance_exec(*args, &block)
12
- begin
13
- old_critical, Thread.critical = Thread.critical, true
14
- n = 0
15
- n += 1 while respond_to?(mname="__instance_exec#{n}")
16
- InstanceExecHelper.module_eval{ define_method(mname, &block) }
17
- ensure
18
- Thread.critical = old_critical
19
- end
20
- begin
21
- ret = send(mname, *args)
22
- ensure
23
- InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil
24
- end
25
- ret
26
- end
27
- end
28
- end
29
2
  class Object
30
3
  def metaclass
31
4
  class << self; self; end
@@ -1,5 +1,3 @@
1
- require 'rubygems'
2
- require 'activesupport'
3
1
 
4
2
  class String
5
3
  # pluralizes a string and turns it into a symbol
@@ -8,4 +6,17 @@ class String
8
6
  def pluralize_to_sym
9
7
  self.pluralize.to_sym
10
8
  end
9
+
10
+ # takes human readable words and
11
+ # turns it into ruby variable format
12
+ # dash and spaces to underscore
13
+ # and lowercases
14
+ def variablize
15
+ self.squeeze!(' ')
16
+ self.gsub!(/\s+/,'_')
17
+ self.gsub!('-', '_')
18
+ self.squeeze!('_')
19
+ self.downcase!
20
+ self
21
+ end
11
22
  end
@@ -0,0 +1,8 @@
1
+ require 'rspec/core/formatters/documentation_formatter'
2
+
3
+ class FailingExamplesFormatter < RSpec::Core::Formatters::DocumentationFormatter
4
+
5
+ def example_passed(example)
6
+ end
7
+
8
+ end
@@ -1,3 +1,5 @@
1
+ require 'active_support/all'
2
+ require 'rspec'
1
3
  require 'taza/page'
2
4
  require 'taza/site'
3
5
  require 'taza/browser'
@@ -9,6 +11,7 @@ require 'extensions/object'
9
11
  require 'extensions/string'
10
12
  require 'extensions/hash'
11
13
  require 'extensions/array'
14
+ require 'formatters/failing_examples_formatter'
12
15
 
13
16
  module ForwardInitialization
14
17
  module ClassMethods
@@ -21,4 +24,3 @@ module ForwardInitialization
21
24
  klass.extend(ClassMethods)
22
25
  end
23
26
  end
24
-
@@ -0,0 +1,24 @@
1
+ require 'taza/page'
2
+ require 'taza/site'
3
+ require 'taza/browser'
4
+ require 'taza/settings'
5
+ require 'taza/flow'
6
+ require 'taza/entity'
7
+ require 'taza/fixtures'
8
+ require 'extensions/object'
9
+ require 'extensions/string'
10
+ require 'extensions/hash'
11
+ require 'extensions/array'
12
+
13
+ module ForwardInitialization
14
+ module ClassMethods
15
+ def new(*args,&block)
16
+ const_get("#{name.split("::").last}").new(*args,&block)
17
+ end
18
+ end
19
+
20
+ def self.included(klass)
21
+ klass.extend(ClassMethods)
22
+ end
23
+ end
24
+
@@ -1,20 +1,20 @@
1
1
  module Taza
2
2
  class Browser
3
-
3
+
4
4
  # Create a browser instance depending on configuration. Configuration should be read in via Taza::Settings.config.
5
- #
5
+ #
6
6
  # Example:
7
7
  # browser = Taza::Browser.create(Taza::Settings.config)
8
8
  #
9
9
  def self.create(params={})
10
10
  self.send("create_#{params[:driver]}".to_sym,params)
11
11
  end
12
-
12
+
13
13
  def self.browser_class(params)
14
14
  self.send("#{params[:driver]}_#{params[:browser]}".to_sym)
15
15
  end
16
16
 
17
- private
17
+ private
18
18
 
19
19
  def self.create_watir(params)
20
20
  method = "watir_#{params[:browser]}"
@@ -23,6 +23,11 @@ module Taza
23
23
  watir
24
24
  end
25
25
 
26
+ def self.create_watir_webdriver(params)
27
+ require 'watir-webdriver'
28
+ Watir::Browser.new(params[:browser])
29
+ end
30
+
26
31
  def self.create_selenium(params)
27
32
  require 'selenium'
28
33
  Selenium::SeleniumDriver.new(params[:server_ip],params[:server_port],'*' + params[:browser].to_s,params[:timeout])
@@ -46,7 +51,7 @@ module Taza
46
51
  browser || Watir::IE.new
47
52
  end
48
53
  end
49
-
54
+
50
55
  # We don't know how to create the browser you asked for
51
56
  class BrowserUnsupportedError < StandardError; end
52
57
  end
@@ -7,7 +7,7 @@ module Taza
7
7
  @fixture = fixture
8
8
  define_methods_for_hash_keys
9
9
  end
10
-
10
+
11
11
  #This method converts hash keys into methods onto the entity
12
12
  def define_methods_for_hash_keys
13
13
  @hash.keys.each do |key|
@@ -30,7 +30,7 @@ module Taza
30
30
  end
31
31
  end
32
32
  alias :[] :get_value_for_entry
33
-
33
+
34
34
  def create_entity_if_value_is_hash(key)
35
35
  if (@fixture.nil? && @hash[key].is_a?(Hash))
36
36
  Entity.new(@hash[key], nil)
@@ -1,11 +1,12 @@
1
1
  require 'taza/fixture'
2
2
 
3
3
  module Taza
4
- dirs = Dir.glob(File.join(Fixture.base_path,'*/'))
5
- dirs.unshift Fixture.base_path
6
- dirs.each do |dir|
7
- mod = dir.sub(Fixture.base_path,File.join(File.basename(Fixture.base_path),'')).camelize.sub(/::$/,'')
8
- self.class_eval <<-EOS
4
+ def self.load_fixtures
5
+ dirs = Dir.glob(File.join(Fixture.base_path,'*/'))
6
+ dirs.unshift Fixture.base_path
7
+ dirs.each do |dir|
8
+ mod = dir.sub(Fixture.base_path,File.join(File.basename(Fixture.base_path),'')).camelize.sub(/::$/,'')
9
+ self.class_eval <<-EOS
9
10
  module #{mod}
10
11
  def self.included(other_module)
11
12
  fixture = Fixture.new
@@ -20,5 +21,8 @@ module Taza
20
21
  end
21
22
  end
22
23
  EOS
24
+ end
23
25
  end
26
+
27
+ self.load_fixtures
24
28
  end
File without changes
@@ -1,4 +1,4 @@
1
- require 'activesupport'
1
+ require 'active_support'
2
2
  require 'taza/options'
3
3
 
4
4
  module Taza
@@ -1,5 +1,3 @@
1
- require 'rubygems'
2
- require 'activesupport'
3
1
 
4
2
  module Taza
5
3
  # An abstraction of a website, but more really a container for a sites pages.
@@ -1,11 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require 'taglob'
4
- require 'spec/rake/spectask'
5
-
6
- def tags
7
- ENV['TAGS']
8
- end
3
+ require 'rspec/core/rake_task'
9
4
 
10
5
  module Taza
11
6
  module Rake
@@ -18,9 +13,9 @@ module Taza
18
13
  end
19
14
 
20
15
  def define_spec_task(name,glob_path)
21
- Spec::Rake::SpecTask.new name do |t|
22
- t.spec_files = Dir.taglob(glob_path,tags)
23
- t.spec_opts << spec_opts
16
+ RSpec::Core::RakeTask.new name do |t|
17
+ t.pattern = Dir.glob(glob_path)
18
+ t.rspec_opts = spec_opts
24
19
  end
25
20
  end
26
21
 
@@ -0,0 +1,3 @@
1
+ module Taza
2
+ VERSION = "0.9.0"
3
+ end