taza 0.8.7 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rvmrc +49 -0
- data/Gemfile +4 -0
- data/History.txt +7 -0
- data/README +1 -3
- data/Rakefile +5 -0
- data/TODO +22 -0
- data/bin/taza +0 -0
- data/generators/flow/flow_generator.rb +1 -1
- data/generators/page/page_generator.rb +1 -1
- data/generators/partial/partial_generator.rb +1 -1
- data/generators/site/site_generator.rb +1 -1
- data/lib/app_generators/taza/taza_generator.rb +1 -1
- data/lib/app_generators/taza/templates/rakefile.rb.erb +5 -4
- data/lib/app_generators/taza/templates/spec_helper.rb.erb +3 -3
- data/lib/extensions/object.rb +0 -27
- data/lib/extensions/string.rb +13 -2
- data/lib/formatters/failing_examples_formatter.rb +8 -0
- data/lib/taza.rb +3 -1
- data/lib/taza.rb.backup +24 -0
- data/lib/taza/browser.rb +10 -5
- data/lib/taza/entity.rb +2 -2
- data/lib/taza/fixtures.rb +9 -5
- data/lib/taza/options.rb +0 -0
- data/lib/taza/settings.rb +1 -1
- data/lib/taza/site.rb +0 -2
- data/lib/taza/tasks.rb +4 -9
- data/lib/taza/version.rb +3 -0
- data/spec/array_spec.rb +4 -4
- data/spec/browser_spec.rb +9 -36
- data/spec/entity_spec.rb +2 -2
- data/spec/fixture_spec.rb +3 -3
- data/spec/fixtures_spec.rb +12 -11
- data/spec/flow_generator_spec.rb +1 -4
- data/spec/hash_spec.rb +1 -1
- data/spec/page_generator_spec.rb +2 -2
- data/spec/page_module_spec.rb +2 -2
- data/spec/page_spec.rb +9 -9
- data/spec/partial_generator_spec.rb +1 -1
- data/spec/platform/windows/browser_win.rb +47 -0
- data/spec/project_generator_spec.rb +1 -15
- 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/settings_spec.rb +1 -1
- data/spec/site_fixtures_spec.rb +2 -5
- data/spec/site_generator_spec.rb +3 -3
- data/spec/site_spec.rb +6 -6
- data/spec/spec_helper.rb +9 -14
- data/spec/string_spec.rb +5 -1
- data/spec/taza_bin_spec.rb +1 -1
- data/spec/taza_tasks_spec.rb +6 -6
- data/taza.gemspec +31 -46
- metadata +170 -117
- data/VERSION.yml +0 -4
- data/spec/object_spec.rb +0 -29
data/spec/array_spec.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'extensions/array'
|
3
3
|
|
4
4
|
describe 'Array Extensions' do
|
5
|
-
it "should know if elements are not
|
5
|
+
it "should know if elements are not equivalent to a subset of those elements" do
|
6
6
|
[1,2,3].should_not be_equivalent([2,3])
|
7
7
|
end
|
8
|
-
it "should know if elements are not
|
8
|
+
it "should know if elements are not equivalent to a larger set including those elements" do
|
9
9
|
[1,2,3].should_not be_equivalent([1,2,3,4])
|
10
|
-
end
|
10
|
+
end
|
11
11
|
it "should know it is equivalent if the same order" do
|
12
12
|
[1,2,3].should be_equivalent([1,2,3])
|
13
13
|
end
|
data/spec/browser_spec.rb
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'taza/browser'
|
3
|
-
require 'taza/settings'
|
4
|
-
require 'taza/options'
|
5
|
-
require 'selenium'
|
6
|
-
require 'watir'
|
1
|
+
require 'spec_helper'
|
7
2
|
|
8
3
|
describe Taza::Browser do
|
9
4
|
|
@@ -26,11 +21,16 @@ describe Taza::Browser do
|
|
26
21
|
Selenium::SeleniumDriver.expects(:new).with(anything,anything,'*opera',anything)
|
27
22
|
Taza::Browser.create(:browser => browser_type, :driver => :selenium)
|
28
23
|
end
|
29
|
-
|
24
|
+
|
30
25
|
it "should raise selenium unsupported browser error" do
|
31
26
|
Taza::Browser.create(:browser => :foo, :driver => :selenium)
|
32
27
|
end
|
33
28
|
|
29
|
+
it "should use params browser type when creating an watir webdriver instance" do
|
30
|
+
Watir::Browser.expects(:new).with(:firefox)
|
31
|
+
browser = Taza::Browser.create(:browser => :firefox, :driver => :watir_webdriver)
|
32
|
+
end
|
33
|
+
|
34
34
|
it "should be able to create a selenium instance" do
|
35
35
|
browser = Taza::Browser.create(:browser => :firefox, :driver => :selenium)
|
36
36
|
browser.should be_a_kind_of(Selenium::SeleniumDriver)
|
@@ -53,34 +53,7 @@ describe Taza::Browser do
|
|
53
53
|
|
54
54
|
it "should be able to give you the class of browser" do
|
55
55
|
Taza::Browser.expects(:watir_safari).returns(Object)
|
56
|
-
Taza::Browser.browser_class(:browser => :safari, :driver => :watir).should eql(Object)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should be able to attach to an open IE instance" do
|
60
|
-
require 'watir'
|
61
|
-
browser = Object.new
|
62
|
-
Watir::IE.stubs(:find).returns(browser)
|
63
|
-
Watir::IE.stubs(:new).returns(browser)
|
64
|
-
old_browser = Watir::IE.new
|
65
|
-
new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir, :attach => true)
|
66
|
-
new_browser.should eql(old_browser)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should be able to open a new IE instance if there is no instance to attach to" do
|
70
|
-
require 'watir'
|
71
|
-
browser = Object.new
|
72
|
-
Watir::IE.stubs(:find).returns()
|
73
|
-
Watir::IE.stubs(:new).returns(browser)
|
74
|
-
new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
|
75
|
-
browser.nil?.should be_false
|
76
|
-
end
|
77
|
-
it "should be able to open a new IE instance if attach not specified" do
|
78
|
-
require 'watir'
|
79
|
-
foo = Object.new
|
80
|
-
bar = Object.new
|
81
|
-
Watir::IE.stubs(:find).returns(foo)
|
82
|
-
Watir::IE.stubs(:new).returns(bar)
|
83
|
-
new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
|
84
|
-
new_browser.should_not eql(foo)
|
56
|
+
Taza::Browser.browser_class(:browser => :safari, :driver => :watir).should eql(Object)
|
85
57
|
end
|
58
|
+
|
86
59
|
end
|
data/spec/entity_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'taza/entity'
|
3
3
|
|
4
4
|
describe Taza::Entity do
|
@@ -21,7 +21,7 @@ describe Taza::Entity do
|
|
21
21
|
entity = Taza::Entity.new({:apple => 'pie' },nil)
|
22
22
|
entity.to_hash[:apple].should eql('pie')
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should be able to do string-to-symbol conversion for hash keys using to_hash" do
|
26
26
|
entity = Taza::Entity.new({'apple' => 'pie' },nil)
|
27
27
|
entity.to_hash[:apple].should eql('pie')
|
data/spec/fixture_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'taza/fixture'
|
3
3
|
require 'extensions/array'
|
4
4
|
|
@@ -25,13 +25,13 @@ describe Taza::Fixture do
|
|
25
25
|
fixture.pluralized_fixture_exists?('example').should be_true
|
26
26
|
fixture.pluralized_fixture_exists?('boo').should be_false
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should be able to get all fixtures loaded excluding sub-folder fixtures" do
|
30
30
|
fixture = Taza::Fixture.new
|
31
31
|
fixture.load_fixtures_from(@base_path)
|
32
32
|
fixture.fixture_names.should be_equivalent([:examples,:users,:foos])
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should be able to get specific fixture entities" do
|
36
36
|
fixture = Taza::Fixture.new
|
37
37
|
fixture.load_fixtures_from(@base_path)
|
data/spec/fixtures_spec.rb
CHANGED
@@ -1,28 +1,29 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
3
|
|
4
4
|
describe "Taza::Fixtures" do
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
Taza::Fixture.stubs(:base_path).returns('./spec/sandbox/fixtures/')
|
7
|
+
Taza.load_fixtures
|
7
8
|
include Taza::Fixtures
|
8
|
-
|
9
|
+
|
9
10
|
it "should be able to look up a fixture entity off fixture_methods module" do
|
10
11
|
examples(:first_example).name.should eql('first')
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
it "should still raise method missing error" do
|
14
15
|
lambda{zomgwtf(:first_example)}.should raise_error(NoMethodError)
|
15
16
|
end
|
16
|
-
|
17
|
+
|
17
18
|
#TODO: this test tests what is in entity's instance eval not happy with it being here
|
18
19
|
it "should be able to look up a fixture entity off fixture_methods module" do
|
19
20
|
examples(:first_example).user.name.should eql(users(:shatner).name)
|
20
21
|
end
|
21
|
-
|
22
|
+
|
22
23
|
it "should be able to resolve one to many relationships" do
|
23
24
|
foos(:gap).examples.length.should eql(2)
|
24
25
|
end
|
25
|
-
|
26
|
+
|
26
27
|
it "should be able to get one to many entities" do
|
27
28
|
foos(:gap).examples['first_example'].name.should eql('first')
|
28
29
|
foos(:gap).examples['second_example'].name.should eql('second')
|
@@ -39,9 +40,9 @@ describe "Taza::Fixtures" do
|
|
39
40
|
it "should be able to get one to many entities for hash[key] style" do
|
40
41
|
foos(:gap)['examples']['first_example']['name'].should eql('first')
|
41
42
|
end
|
42
|
-
|
43
|
+
|
43
44
|
it "should be able to access multiple levels inside fixtures" do
|
44
|
-
examples(:forth_example).something.user
|
45
|
+
examples(:forth_example).something.user.name.should eql('William Shatner')
|
45
46
|
end
|
46
47
|
|
47
48
|
end
|
data/spec/flow_generator_spec.rb
CHANGED
data/spec/hash_spec.rb
CHANGED
data/spec/page_generator_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'taza/page'
|
@@ -20,7 +20,7 @@ describe "Page Generation" do
|
|
20
20
|
after :each do
|
21
21
|
bare_teardown
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it "should give you usage if you do not give two arguments" do
|
25
25
|
PageGenerator.any_instance.expects(:usage)
|
26
26
|
lambda { run_generator('page', [@page_name], generator_sources) }.should raise_error
|
data/spec/page_module_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'taza/page'
|
3
3
|
|
4
4
|
describe "Taza Page Module" do
|
@@ -136,7 +136,7 @@ describe "Taza Page Module" do
|
|
136
136
|
lambda { page.sample_element }.should raise_error(Taza::FilterError)
|
137
137
|
page.another_sample_element.should eql(:something)
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
class PageWithFiltersAndModulesAndElements < ::Taza::Page
|
141
141
|
page_module :foo_module do
|
142
142
|
element(:sample_element) {:something}
|
data/spec/page_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'taza/page'
|
3
3
|
|
4
4
|
describe Taza::Page do
|
5
|
-
|
5
|
+
|
6
6
|
class ElementAndFilterContextExample < Taza::Page
|
7
7
|
element(:sample_element) {browser}
|
8
8
|
filter:sample_filter, :sample_element
|
@@ -29,17 +29,17 @@ describe Taza::Page do
|
|
29
29
|
Taza::Page.element(:boo){|baz| baz}
|
30
30
|
Taza::Page.new.boo("rofl").should == "rofl"
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "should execute elements and filters in the context of the page instance" do
|
34
34
|
page = ElementAndFilterContextExample.new
|
35
35
|
page.browser = :something
|
36
36
|
page.sample_element.should eql(:something)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "should add a filter to the classes filters" do
|
40
|
-
ElementAndFilterContextExample.filters.size.should eql(1)
|
40
|
+
ElementAndFilterContextExample.filters.size.should eql(1)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
it "should store the block given to the element method in a method with the name of the parameter" do
|
44
44
|
Taza::Page.element(:foo) do
|
45
45
|
"bar"
|
@@ -56,12 +56,12 @@ describe Taza::Page do
|
|
56
56
|
false
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
it "should filter all elements if element argument is not provided" do
|
61
61
|
lambda { FilterAllElements.new.apple }.should raise_error(Taza::FilterError)
|
62
62
|
lambda { FilterAllElements.new.foo }.should raise_error(Taza::FilterError)
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it "should have empty elements on a new class" do
|
66
66
|
foo = Class::new(superclass=Taza::Page)
|
67
67
|
foo.elements.should_not be_nil
|
@@ -87,7 +87,7 @@ describe Taza::Page do
|
|
87
87
|
it "should raise a error if an elements is called and its filter returns false" do
|
88
88
|
lambda { FilterAnElement.new.false_item }.should raise_error(Taza::FilterError)
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
it "should not call element block if filters fail" do
|
92
92
|
page = FilterAnElement.new
|
93
93
|
lambda { page.false_item }.should raise_error
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
require 'taza/browser'
|
3
|
+
require 'taza/settings'
|
4
|
+
require 'taza/options'
|
5
|
+
require 'selenium'
|
6
|
+
require 'watir'
|
7
|
+
|
8
|
+
describe Taza::Browser do
|
9
|
+
|
10
|
+
before :each do
|
11
|
+
Taza::Settings.stubs(:config_file).returns({})
|
12
|
+
ENV['TAZA_ENV'] = 'isolation'
|
13
|
+
ENV['SERVER_PORT'] = nil
|
14
|
+
ENV['SERVER_IP'] = nil
|
15
|
+
ENV['BROWSER'] = nil
|
16
|
+
ENV['DRIVER'] = nil
|
17
|
+
ENV['TIMEOUT'] = nil
|
18
|
+
end
|
19
|
+
it "should be able to attach to an open IE instance" do
|
20
|
+
require 'watir'
|
21
|
+
browser = Object.new
|
22
|
+
Watir::IE.stubs(:find).returns(browser)
|
23
|
+
Watir::IE.stubs(:new).returns(browser)
|
24
|
+
old_browser = Watir::IE.new
|
25
|
+
new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir, :attach => true)
|
26
|
+
new_browser.should eql(old_browser)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to open a new IE instance if there is no instance to attach to" do
|
30
|
+
require 'watir'
|
31
|
+
browser = Object.new
|
32
|
+
Watir::IE.stubs(:find).returns()
|
33
|
+
Watir::IE.stubs(:new).returns(browser)
|
34
|
+
new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
|
35
|
+
browser.nil?.should be_false
|
36
|
+
end
|
37
|
+
it "should be able to open a new IE instance if attach not specified" do
|
38
|
+
require 'watir'
|
39
|
+
foo = Object.new
|
40
|
+
bar = Object.new
|
41
|
+
Watir::IE.stubs(:find).returns(foo)
|
42
|
+
Watir::IE.stubs(:new).returns(bar)
|
43
|
+
new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
|
44
|
+
new_browser.should_not eql(foo)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake'
|
4
4
|
require 'fileutils'
|
@@ -29,20 +29,6 @@ describe "Project Generator" do
|
|
29
29
|
system("ruby -c #{@spec_helper} > #{null_device}").should be_true
|
30
30
|
end
|
31
31
|
|
32
|
-
it "spec helper should set the TAZA_ENV variable if it is not provided" do
|
33
|
-
ENV['TAZA_ENV'] = nil
|
34
|
-
run_generator('taza', [APP_ROOT], generator_sources)
|
35
|
-
load @spec_helper
|
36
|
-
ENV['TAZA_ENV'].should eql("isolation")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "spec helper should not override the TAZA_ENV variable if was provided" do
|
40
|
-
ENV['TAZA_ENV'] = 'orange pie? is there such a thing?'
|
41
|
-
run_generator('taza', [APP_ROOT], generator_sources)
|
42
|
-
load @spec_helper
|
43
|
-
ENV['TAZA_ENV'].should eql('orange pie? is there such a thing?')
|
44
|
-
end
|
45
|
-
|
46
32
|
it "should generate a console script" do
|
47
33
|
run_generator('taza', [APP_ROOT], generator_sources)
|
48
34
|
File.exists?(File.join(APP_ROOT,'script','console')).should be_true
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/settings_spec.rb
CHANGED
data/spec/site_fixtures_spec.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'taza/fixture'
|
3
|
-
|
1
|
+
require 'spec_helper'
|
4
2
|
describe "Site Specific Fixtures" do
|
5
3
|
Taza::Fixture.stubs(:base_path).returns(File.join('.','spec','sandbox','fixtures',''))
|
6
|
-
|
4
|
+
Taza.load_fixtures
|
7
5
|
include Taza::Fixtures::FooSite
|
8
6
|
|
9
7
|
it "should be able to access fixtures in sub-folders" do
|
@@ -13,5 +11,4 @@ describe "Site Specific Fixtures" do
|
|
13
11
|
it "should not be able to access non-site-specific fixtures" do
|
14
12
|
lambda{foos(:gap)}.should raise_error(NoMethodError)
|
15
13
|
end
|
16
|
-
|
17
14
|
end
|
data/spec/site_generator_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'fileutils'
|
4
4
|
|
@@ -6,7 +6,7 @@ describe "Site Generation" do
|
|
6
6
|
include RubiGen::GeneratorTestHelper
|
7
7
|
include Helpers::Generator
|
8
8
|
include Helpers::Taza
|
9
|
-
|
9
|
+
|
10
10
|
before :all do
|
11
11
|
@spec_helper = File.join(TMP_ROOT,PROJECT_NAME,'spec','spec_helper.rb')
|
12
12
|
@site_name = "WikipediaFoo"
|
@@ -42,7 +42,7 @@ describe "Site Generation" do
|
|
42
42
|
run_generator('site', [@site_name], generator_sources)
|
43
43
|
File.directory?(File.join(PROJECT_FOLDER,'spec','isolation','wikipedia_foo')).should be_true
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
it "generated site that uses the block given in new" do
|
47
47
|
@site_class = generate_site(@site_name)
|
48
48
|
stub_settings
|
data/spec/site_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'rubygems'
|
3
3
|
require 'taza/site'
|
4
4
|
require 'taza/settings'
|
@@ -205,12 +205,12 @@ describe Taza::Site do
|
|
205
205
|
Foo.new() {}
|
206
206
|
end
|
207
207
|
|
208
|
-
|
208
|
+
|
209
209
|
module Zoro
|
210
210
|
class Zoro < ::Taza::Site
|
211
211
|
end
|
212
212
|
end
|
213
|
-
|
213
|
+
|
214
214
|
it "should pass in the class name to settings config" do
|
215
215
|
browser = stub()
|
216
216
|
browser.stubs(:goto)
|
@@ -218,12 +218,12 @@ describe Taza::Site do
|
|
218
218
|
Taza::Settings.expects(:config).with('Zoro').returns({})
|
219
219
|
Zoro::Zoro.new
|
220
220
|
end
|
221
|
-
|
221
|
+
|
222
222
|
it "should load settings based on the sites class name" do
|
223
223
|
Taza::Settings.expects(:site_file).with('Zoro').returns({})
|
224
224
|
Zoro::Zoro.settings
|
225
225
|
end
|
226
|
-
|
226
|
+
|
227
227
|
def stub_browser
|
228
228
|
browser = stub()
|
229
229
|
browser.stubs(:close)
|
@@ -257,7 +257,7 @@ describe Taza::Site do
|
|
257
257
|
Taza::Site.donot_close_browser
|
258
258
|
Foo.new {}
|
259
259
|
end
|
260
|
-
|
260
|
+
|
261
261
|
it "should have a way to keep the browser instance open if an error is raised" do
|
262
262
|
browser = stub_browser
|
263
263
|
browser.expects(:close).never
|