taza 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +8 -0
- data/VERSION.yml +4 -4
- data/bin/taza +0 -0
- data/lib/app_generators/taza/taza_generator.rb +0 -1
- data/lib/taza/entity.rb +16 -2
- data/lib/taza/page.rb +11 -1
- data/lib/taza/site.rb +6 -1
- data/spec/entity_spec.rb +10 -0
- data/spec/fixtures_spec.rb +4 -0
- data/spec/page_module_spec.rb +61 -0
- data/spec/page_spec.rb +9 -0
- data/spec/sandbox/fixtures/examples.yml +3 -0
- data/spec/sandbox/fixtures/foo_site/bars.yml +0 -0
- data/spec/sandbox/fixtures/foos.yml +0 -0
- data/spec/sandbox/pages/foo/bay.rb +0 -0
- data/spec/sandbox/pages/foo/baz.rb +0 -0
- data/spec/site_fixtures_spec.rb +0 -0
- data/spec/site_spec.rb +16 -1
- data/taza.gemspec +46 -0
- metadata +10 -5
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 0.8.6
|
2
|
+
|
3
|
+
* Added feature to keep browser open after tests
|
4
|
+
* Added access to multiple levels in Fixtures
|
5
|
+
* Added feature to return a Hash in Fixtures
|
6
|
+
* lib/flows is no longer generated
|
7
|
+
* Page module filters for elements inside page modules
|
8
|
+
|
1
9
|
=== 0.8.5
|
2
10
|
|
3
11
|
* Fixed Fixtures bugs
|
data/VERSION.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
---
|
2
|
-
:patch:
|
3
|
-
:major: 0
|
4
|
-
:minor: 8
|
1
|
+
---
|
2
|
+
:patch: 6
|
3
|
+
:major: 0
|
4
|
+
:minor: 8
|
data/bin/taza
CHANGED
File without changes
|
@@ -30,7 +30,6 @@ class TazaGenerator < RubiGen::Base
|
|
30
30
|
def create_directories(m)
|
31
31
|
BASEDIRS.each { |path| m.directory path }
|
32
32
|
m.directory File.join('lib','sites')
|
33
|
-
m.directory File.join('lib','flows')
|
34
33
|
m.directory File.join('spec','isolation')
|
35
34
|
m.directory File.join('spec','integration')
|
36
35
|
m.directory File.join('spec','story')
|
data/lib/taza/entity.rb
CHANGED
@@ -20,16 +20,30 @@ module Taza
|
|
20
20
|
#This method will lookup another fixture if a pluralized fixture exists otherwise return the value in the hash
|
21
21
|
def get_value_for_entry(key) # :nodoc:
|
22
22
|
if @fixture.nil?
|
23
|
-
|
23
|
+
create_entity_if_value_is_hash(key)
|
24
24
|
elsif @fixture.fixture_exists?(key)
|
25
25
|
@fixture.specific_fixture_entities(key.to_sym, @hash[key])
|
26
26
|
elsif @fixture.pluralized_fixture_exists?(key)
|
27
27
|
@fixture.get_fixture_entity(key.pluralize.to_sym,@hash[key])
|
28
28
|
else
|
29
|
-
|
29
|
+
create_entity_if_value_is_hash(key)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
alias :[] :get_value_for_entry
|
33
|
+
|
34
|
+
def create_entity_if_value_is_hash(key)
|
35
|
+
if (@fixture.nil? && @hash[key].is_a?(Hash))
|
36
|
+
Entity.new(@hash[key], nil)
|
37
|
+
elsif (!@fixture.nil? && @hash[key].is_a?(Hash))
|
38
|
+
Entity.new(@hash[key], @fixture)
|
39
|
+
else
|
40
|
+
@hash[key]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_hash
|
45
|
+
@hash
|
46
|
+
end
|
33
47
|
|
34
48
|
private
|
35
49
|
def create_method(name, &block) # :nodoc:
|
data/lib/taza/page.rb
CHANGED
@@ -35,6 +35,8 @@ module Taza
|
|
35
35
|
if !@module.nil?
|
36
36
|
self.elements[@module] = Hash.new if self.elements[@module].nil?
|
37
37
|
self.elements[@module] = self.elements[@module].merge({ name => block })
|
38
|
+
elsif !self.elements[name].nil?
|
39
|
+
raise ElementError,"Duplicate definations for Element - #{name} on Page - #{self.to_s}"
|
38
40
|
else
|
39
41
|
self.elements[name] = block
|
40
42
|
end
|
@@ -74,6 +76,13 @@ module Taza
|
|
74
76
|
yield(block)
|
75
77
|
@module = nil
|
76
78
|
end
|
79
|
+
|
80
|
+
def self.page_module_filter(method_name, page_module_name, *elements)
|
81
|
+
elements = [page_module_name] if elements.empty?
|
82
|
+
elements.each do |element|
|
83
|
+
self.filters[element] = self.filters[element] << method_name
|
84
|
+
end
|
85
|
+
end
|
77
86
|
|
78
87
|
def initialize(page_module = nil)
|
79
88
|
add_element_methods(page_module)
|
@@ -84,7 +93,7 @@ module Taza
|
|
84
93
|
self.class.elements.each do |element_name,element_block|
|
85
94
|
if (element_block.is_a?(Hash) && !page_module.nil? && page_module==element_name)
|
86
95
|
element_block.each do |key,value|
|
87
|
-
filters = self.class.filters[element_name] + self.class.filters[:all]
|
96
|
+
filters = self.class.filters[element_name] + self.class.filters[:all] + self.class.filters[key]
|
88
97
|
add_element_method(:filters => filters, :element_name => key, :element_block => value)
|
89
98
|
end
|
90
99
|
else
|
@@ -115,4 +124,5 @@ module Taza
|
|
115
124
|
end
|
116
125
|
|
117
126
|
class FilterError < StandardError; end
|
127
|
+
class ElementError < StandardError; end
|
118
128
|
end
|
data/lib/taza/site.rb
CHANGED
@@ -18,6 +18,7 @@ module Taza
|
|
18
18
|
# end
|
19
19
|
class Site
|
20
20
|
@@before_browser_closes = Proc.new() {}
|
21
|
+
@@donot_close_browser = false
|
21
22
|
# Use this to do something with the browser before it closes, but note that it is a class method which
|
22
23
|
# means that this will get called for any instance of a site.
|
23
24
|
#
|
@@ -29,6 +30,10 @@ module Taza
|
|
29
30
|
def self.before_browser_closes(&block)
|
30
31
|
@@before_browser_closes = block
|
31
32
|
end
|
33
|
+
|
34
|
+
def self.donot_close_browser
|
35
|
+
@@donot_close_browser = true
|
36
|
+
end
|
32
37
|
attr_accessor :browser
|
33
38
|
|
34
39
|
# A site can be called a few different ways
|
@@ -81,7 +86,7 @@ module Taza
|
|
81
86
|
|
82
87
|
def close_browser_and_raise_if original_error # :nodoc:
|
83
88
|
begin
|
84
|
-
@browser.close if @i_created_browser
|
89
|
+
@browser.close if (@i_created_browser && !@@donot_close_browser)
|
85
90
|
ensure
|
86
91
|
raise original_error if original_error
|
87
92
|
end
|
data/spec/entity_spec.rb
CHANGED
@@ -12,4 +12,14 @@ describe Taza::Entity do
|
|
12
12
|
entity[:apple].should eql('pie')
|
13
13
|
end
|
14
14
|
|
15
|
+
it "should be able to define methods for multiple levels" do
|
16
|
+
entity = Taza::Entity.new({:fruits => {:apple => 'pie'} },nil)
|
17
|
+
entity.fruits.apple.should eql('pie')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be able to return a hash object" do
|
21
|
+
entity = Taza::Entity.new({:apple => 'pie' },nil)
|
22
|
+
entity.to_hash[:apple].should eql('pie')
|
23
|
+
end
|
24
|
+
|
15
25
|
end
|
data/spec/fixtures_spec.rb
CHANGED
@@ -39,5 +39,9 @@ describe "Taza::Fixtures" do
|
|
39
39
|
it "should be able to get one to many entities for hash[key] style" do
|
40
40
|
foos(:gap)['examples']['first_example']['name'].should eql('first')
|
41
41
|
end
|
42
|
+
|
43
|
+
it "should be able to access multiple levels inside fixtures" do
|
44
|
+
examples(:forth_example).something.user('shatner').name.should eql('William Shatner')
|
45
|
+
end
|
42
46
|
|
43
47
|
end
|
data/spec/page_module_spec.rb
CHANGED
@@ -101,4 +101,65 @@ describe "Taza Page Module" do
|
|
101
101
|
lambda { page.sample_element }.should raise_error(Taza::FilterError)
|
102
102
|
end
|
103
103
|
|
104
|
+
class PageWithFilterAndModuleElements < ::Taza::Page
|
105
|
+
page_module :module do
|
106
|
+
element(:sample_element) {:something}
|
107
|
+
end
|
108
|
+
page_module_filter :sample_filter, :module, :sample_element
|
109
|
+
def sample_filter
|
110
|
+
false
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should execute filters for elements inside page modules" do
|
115
|
+
page = PageWithFilterAndModuleElements.new(:module)
|
116
|
+
lambda { page.sample_element }.should raise_error(Taza::FilterError)
|
117
|
+
end
|
118
|
+
|
119
|
+
class PageWithFiltersAndModuleElements < ::Taza::Page
|
120
|
+
page_module :module do
|
121
|
+
element(:sample_element) {:something}
|
122
|
+
element(:another_sample_element) {:something}
|
123
|
+
end
|
124
|
+
page_module_filter :sample_filter, :module
|
125
|
+
def sample_filter
|
126
|
+
true
|
127
|
+
end
|
128
|
+
page_module_filter :another_sample_filter, :module, :sample_element
|
129
|
+
def another_sample_filter
|
130
|
+
false
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should execute filters for specific and all elements inside page modules" do
|
135
|
+
page = PageWithFiltersAndModuleElements.new(:module)
|
136
|
+
lambda { page.sample_element }.should raise_error(Taza::FilterError)
|
137
|
+
page.another_sample_element.should eql(:something)
|
138
|
+
end
|
139
|
+
|
140
|
+
class PageWithFiltersAndModulesAndElements < ::Taza::Page
|
141
|
+
page_module :foo_module do
|
142
|
+
element(:sample_element) {:something}
|
143
|
+
end
|
144
|
+
page_module_filter :foo_filter, :foo_module
|
145
|
+
def foo_filter
|
146
|
+
true
|
147
|
+
end
|
148
|
+
page_module :bar_module do
|
149
|
+
element(:sample_element) {:nothing}
|
150
|
+
end
|
151
|
+
page_module_filter :bar_filter, :bar_module
|
152
|
+
def bar_filter
|
153
|
+
false
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should execute page module filters for identical element names appropriately" do
|
158
|
+
foo = PageWithFiltersAndModulesAndElements.new(:foo_module)
|
159
|
+
foo.sample_element.should eql(:something)
|
160
|
+
bar = PageWithFiltersAndModulesAndElements.new(:bar_module)
|
161
|
+
lambda { bar.sample_element }.should raise_error(Taza::FilterError)
|
162
|
+
end
|
163
|
+
|
164
|
+
|
104
165
|
end
|
data/spec/page_spec.rb
CHANGED
@@ -93,4 +93,13 @@ describe Taza::Page do
|
|
93
93
|
lambda { page.false_item }.should raise_error
|
94
94
|
page.called_element_method.should_not be_true
|
95
95
|
end
|
96
|
+
|
97
|
+
it "should not allow more than one element descriptor with the same element name" do
|
98
|
+
lambda{
|
99
|
+
class DuplicateElements < Taza::Page
|
100
|
+
element(:foo) { true }
|
101
|
+
element(:foo) { false }
|
102
|
+
end
|
103
|
+
}.should raise_error(Taza::ElementError)
|
104
|
+
end
|
96
105
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/site_fixtures_spec.rb
CHANGED
File without changes
|
data/spec/site_spec.rb
CHANGED
@@ -240,7 +240,7 @@ describe Taza::Site do
|
|
240
240
|
barzor.some_element.should eql(:some_element_value)
|
241
241
|
end
|
242
242
|
|
243
|
-
it "should raise an error when accessing an element
|
243
|
+
it "should raise an error when accessing an element that belongs to another module" do
|
244
244
|
f = Foo.new(:browser => stub_browser)
|
245
245
|
barzor = nil
|
246
246
|
f.baz(:another_module) do |baz|
|
@@ -249,4 +249,19 @@ describe Taza::Site do
|
|
249
249
|
lambda{barzor.other_element}.should raise_error(NoMethodError)
|
250
250
|
end
|
251
251
|
|
252
|
+
it "should have a way to keep the browser instance open" do
|
253
|
+
browser = stub_browser
|
254
|
+
browser.expects(:close).never
|
255
|
+
Taza::Browser.stubs(:create).returns(browser)
|
256
|
+
Taza::Site.donot_close_browser
|
257
|
+
Foo.new {}
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should have a way to keep the browser instance open if an error is raised" do
|
261
|
+
browser = stub_browser
|
262
|
+
browser.expects(:close).never
|
263
|
+
Taza::Browser.stubs(:create).returns(browser)
|
264
|
+
Taza::Site.donot_close_browser
|
265
|
+
lambda { Foo.new { |site| raise StandardError}}.should raise_error
|
266
|
+
end
|
252
267
|
end
|
data/taza.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{taza}
|
3
|
+
s.version = "0.8.6"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Adam Anderson"]
|
7
|
+
s.date = %q{2009-04-08}
|
8
|
+
s.default_executable = %q{taza}
|
9
|
+
s.description = %q{Taza is an opionated browser-based testing framework.}
|
10
|
+
s.email = %q{adamandersonis@gmail.com}
|
11
|
+
s.executables = ["taza"]
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "README.textile", "taza.gemspec", "VERSION.yml", "bin/taza", "generators/flow", "generators/flow/flow_generator.rb", "generators/flow/templates", "generators/flow/templates/flow.rb.erb", "generators/page", "generators/page/page_generator.rb", "generators/page/templates", "generators/page/templates/functional_page_spec.rb.erb", "generators/page/templates/page.rb.erb", "generators/partial", "generators/partial/partial_generator.rb", "generators/partial/templates", "generators/partial/templates/partial.rb.erb", "generators/site", "generators/site/site_generator.rb", "generators/site/templates", "generators/site/templates/site.rb.erb", "generators/site/templates/site.yml.erb", "lib/app_generators", "lib/app_generators/taza", "lib/app_generators/taza/taza_generator.rb", "lib/app_generators/taza/templates", "lib/app_generators/taza/templates/config.yml.erb", "lib/app_generators/taza/templates/rakefile.rb.erb", "lib/app_generators/taza/templates/spec_helper.rb.erb", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/browsers", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/fixtures.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/flow_generator_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_module_spec.rb", "spec/page_spec.rb", "spec/partial_generator_spec.rb", "spec/platform", "spec/platform/osx", "spec/platform/windows", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/site_name.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/foos.yml", "spec/sandbox/fixtures/foo_site", "spec/sandbox/fixtures/foo_site/bars.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.rb", "spec/sandbox/pages/foo/bay.rb", "spec/sandbox/pages/foo/baz.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/site_fixtures_spec.rb", "spec/site_generator_spec.rb", "spec/site_spec.rb", "spec/spec_helper.rb", "spec/string_spec.rb", "spec/taza_bin_spec.rb", "spec/taza_tasks_spec.rb", "README"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/scudco/taza}
|
16
|
+
s.rdoc_options = ["--main", "README", "--inline-source", "--charset=UTF-8"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{taza}
|
19
|
+
s.rubygems_version = %q{1.2.0}
|
20
|
+
s.summary = %q{Taza is an opionated browser-based testing framework.}
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if current_version >= 3 then
|
27
|
+
s.add_runtime_dependency(%q<taglob>, [">= 1.1.1"])
|
28
|
+
s.add_runtime_dependency(%q<rake>, [">= 0.8.3"])
|
29
|
+
s.add_runtime_dependency(%q<mocha>, [">= 0.9.3"])
|
30
|
+
s.add_runtime_dependency(%q<rspec>, [">= 1.1.12"])
|
31
|
+
s.add_runtime_dependency(%q<rubigen>, [">= 1.4.0"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<taglob>, [">= 1.1.1"])
|
34
|
+
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
35
|
+
s.add_dependency(%q<mocha>, [">= 0.9.3"])
|
36
|
+
s.add_dependency(%q<rspec>, [">= 1.1.12"])
|
37
|
+
s.add_dependency(%q<rubigen>, [">= 1.4.0"])
|
38
|
+
end
|
39
|
+
else
|
40
|
+
s.add_dependency(%q<taglob>, [">= 1.1.1"])
|
41
|
+
s.add_dependency(%q<rake>, [">= 0.8.3"])
|
42
|
+
s.add_dependency(%q<mocha>, [">= 0.9.3"])
|
43
|
+
s.add_dependency(%q<rspec>, [">= 1.1.12"])
|
44
|
+
s.add_dependency(%q<rubigen>, [">= 1.4.0"])
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Anderson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-08 00:00:00 -07:00
|
13
13
|
default_executable: taza
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- History.txt
|
77
77
|
- Manifest.txt
|
78
78
|
- README.textile
|
79
|
+
- taza.gemspec
|
79
80
|
- VERSION.yml
|
80
81
|
- bin/taza
|
81
82
|
- generators/flow
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- lib/extensions/string.rb
|
111
112
|
- lib/taza
|
112
113
|
- lib/taza/browser.rb
|
114
|
+
- lib/taza/browsers
|
113
115
|
- lib/taza/entity.rb
|
114
116
|
- lib/taza/fixture.rb
|
115
117
|
- lib/taza/fixtures.rb
|
@@ -122,8 +124,8 @@ files:
|
|
122
124
|
- spec/array_spec.rb
|
123
125
|
- spec/browser_spec.rb
|
124
126
|
- spec/entity_spec.rb
|
125
|
-
- spec/fixture_spec.rb
|
126
127
|
- spec/fixtures_spec.rb
|
128
|
+
- spec/fixture_spec.rb
|
127
129
|
- spec/flow_generator_spec.rb
|
128
130
|
- spec/hash_spec.rb
|
129
131
|
- spec/object_spec.rb
|
@@ -131,6 +133,9 @@ files:
|
|
131
133
|
- spec/page_module_spec.rb
|
132
134
|
- spec/page_spec.rb
|
133
135
|
- spec/partial_generator_spec.rb
|
136
|
+
- spec/platform
|
137
|
+
- spec/platform/osx
|
138
|
+
- spec/platform/windows
|
134
139
|
- spec/project_generator_spec.rb
|
135
140
|
- spec/sandbox
|
136
141
|
- spec/sandbox/config
|
@@ -139,9 +144,9 @@ files:
|
|
139
144
|
- spec/sandbox/config.yml
|
140
145
|
- spec/sandbox/fixtures
|
141
146
|
- spec/sandbox/fixtures/examples.yml
|
147
|
+
- spec/sandbox/fixtures/foos.yml
|
142
148
|
- spec/sandbox/fixtures/foo_site
|
143
149
|
- spec/sandbox/fixtures/foo_site/bars.yml
|
144
|
-
- spec/sandbox/fixtures/foos.yml
|
145
150
|
- spec/sandbox/fixtures/users.yml
|
146
151
|
- spec/sandbox/flows
|
147
152
|
- spec/sandbox/flows/batman.rb
|
@@ -187,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
192
|
requirements: []
|
188
193
|
|
189
194
|
rubyforge_project: taza
|
190
|
-
rubygems_version: 1.
|
195
|
+
rubygems_version: 1.2.0
|
191
196
|
signing_key:
|
192
197
|
specification_version: 2
|
193
198
|
summary: Taza is an opionated browser-based testing framework.
|