should_pricot 1.0.0

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.
Files changed (94) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/Manifest +92 -0
  3. data/README.rdoc +45 -0
  4. data/Rakefile +36 -0
  5. data/lib/should_pricot.rb +19 -0
  6. data/lib/should_pricot/count_assertion.rb +12 -0
  7. data/lib/should_pricot/element_assertion.rb +39 -0
  8. data/should_pricot.gemspec +31 -0
  9. data/tasks/should_pricot_tasks.rake +4 -0
  10. data/test/fixtures/posts.yml +4 -0
  11. data/test/fixtures/users.yml +9 -0
  12. data/test/functional/users_controller_test.rb +16 -0
  13. data/test/should_pricot_test.rb +6 -0
  14. data/test/test-app/app/controllers/application_controller.rb +10 -0
  15. data/test/test-app/app/controllers/users_controller.rb +40 -0
  16. data/test/test-app/app/helpers/application_helper.rb +3 -0
  17. data/test/test-app/app/models/post.rb +3 -0
  18. data/test/test-app/app/models/user.rb +7 -0
  19. data/test/test-app/app/views/users/edit.html.erb +0 -0
  20. data/test/test-app/app/views/users/index.html.erb +9 -0
  21. data/test/test-app/app/views/users/new.html.erb +0 -0
  22. data/test/test-app/config/boot.rb +110 -0
  23. data/test/test-app/config/database.yml +4 -0
  24. data/test/test-app/config/environment.rb +12 -0
  25. data/test/test-app/config/environments/test.rb +0 -0
  26. data/test/test-app/config/initializers/funktional.rb +8 -0
  27. data/test/test-app/config/initializers/new_rails_defaults.rb +21 -0
  28. data/test/test-app/config/routes.rb +5 -0
  29. data/test/test-app/db/migrate/001_create_users.rb +18 -0
  30. data/test/test-app/db/migrate/002_create_posts.rb +13 -0
  31. data/test/test-app/public/404.html +30 -0
  32. data/test/test-app/public/422.html +30 -0
  33. data/test/test-app/public/500.html +30 -0
  34. data/test/test-app/script/console +3 -0
  35. data/test/test-app/script/generate +3 -0
  36. data/test/test-app/vendor/plugins/funktional/MIT-LICENSE +20 -0
  37. data/test/test-app/vendor/plugins/funktional/README.rdoc +289 -0
  38. data/test/test-app/vendor/plugins/funktional/Rakefile +23 -0
  39. data/test/test-app/vendor/plugins/funktional/init.rb +8 -0
  40. data/test/test-app/vendor/plugins/funktional/install.rb +1 -0
  41. data/test/test-app/vendor/plugins/funktional/lib/funktional.rb +41 -0
  42. data/test/test-app/vendor/plugins/funktional/lib/funktional/assertion.rb +9 -0
  43. data/test/test-app/vendor/plugins/funktional/lib/funktional/assigned_assertion.rb +39 -0
  44. data/test/test-app/vendor/plugins/funktional/lib/funktional/attribute_test_helper.rb +27 -0
  45. data/test/test-app/vendor/plugins/funktional/lib/funktional/context.rb +126 -0
  46. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/assigned_should_block.rb +32 -0
  47. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/collector.rb +21 -0
  48. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/count_should_block.rb +21 -0
  49. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/delegating_should_block.rb +30 -0
  50. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/element_should_block.rb +29 -0
  51. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/flashed_should_block.rb +17 -0
  52. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_block.rb +60 -0
  53. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_create_block.rb +17 -0
  54. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_delete_block.rb +17 -0
  55. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_block.rb +20 -0
  56. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_create_block.rb +17 -0
  57. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_delete_block.rb +17 -0
  58. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_send_email_block.rb +18 -0
  59. data/test/test-app/vendor/plugins/funktional/lib/funktional/context/stack_recorder.rb +34 -0
  60. data/test/test-app/vendor/plugins/funktional/lib/funktional/email_assertion.rb +50 -0
  61. data/test/test-app/vendor/plugins/funktional/lib/funktional/flashed_assertion.rb +12 -0
  62. data/test/test-app/vendor/plugins/funktional/lib/funktional/model_assertions.rb +108 -0
  63. data/test/test-app/vendor/plugins/funktional/lib/funktional/random_characters.rb +11 -0
  64. data/test/test-app/vendor/plugins/funktional/lib/funktional/recursive_assertion.rb +23 -0
  65. data/test/test-app/vendor/plugins/funktional/lib/funktional/route_checker.rb +49 -0
  66. data/test/test-app/vendor/plugins/funktional/lib/funktional/setup.rb +11 -0
  67. data/test/test-app/vendor/plugins/funktional/lib/funktional/test_class_methods.rb +28 -0
  68. data/test/test-app/vendor/plugins/funktional/lib/funktional/test_instance_methods.rb +131 -0
  69. data/test/test-app/vendor/plugins/funktional/tasks/should_b_tasks.rake +4 -0
  70. data/test/test-app/vendor/plugins/funktional/test/fixtures/posts.yml +4 -0
  71. data/test/test-app/vendor/plugins/funktional/test/fixtures/users.yml +5 -0
  72. data/test/test-app/vendor/plugins/funktional/test/test-app/app/controllers/application_controller.rb +10 -0
  73. data/test/test-app/vendor/plugins/funktional/test/test-app/app/helpers/application_helper.rb +3 -0
  74. data/test/test-app/vendor/plugins/funktional/test/test-app/app/models/post.rb +3 -0
  75. data/test/test-app/vendor/plugins/funktional/test/test-app/app/models/user.rb +7 -0
  76. data/test/test-app/vendor/plugins/funktional/test/test-app/config/boot.rb +110 -0
  77. data/test/test-app/vendor/plugins/funktional/test/test-app/config/database.yml +4 -0
  78. data/test/test-app/vendor/plugins/funktional/test/test-app/config/environment.rb +12 -0
  79. data/test/test-app/vendor/plugins/funktional/test/test-app/config/environments/test.rb +0 -0
  80. data/test/test-app/vendor/plugins/funktional/test/test-app/config/initializers/funktional.rb +8 -0
  81. data/test/test-app/vendor/plugins/funktional/test/test-app/config/initializers/new_rails_defaults.rb +21 -0
  82. data/test/test-app/vendor/plugins/funktional/test/test-app/config/routes.rb +4 -0
  83. data/test/test-app/vendor/plugins/funktional/test/test-app/db/migrate/001_create_users.rb +18 -0
  84. data/test/test-app/vendor/plugins/funktional/test/test-app/db/migrate/002_create_posts.rb +13 -0
  85. data/test/test-app/vendor/plugins/funktional/test/test-app/public/404.html +30 -0
  86. data/test/test-app/vendor/plugins/funktional/test/test-app/public/422.html +30 -0
  87. data/test/test-app/vendor/plugins/funktional/test/test-app/public/500.html +30 -0
  88. data/test/test-app/vendor/plugins/funktional/test/test-app/script/console +3 -0
  89. data/test/test-app/vendor/plugins/funktional/test/test-app/script/generate +3 -0
  90. data/test/test-app/vendor/plugins/funktional/test/test_helper.rb +27 -0
  91. data/test/test-app/vendor/plugins/funktional/test/unit/user_test.rb +12 -0
  92. data/test/test-app/vendor/plugins/funktional/uninstall.rb +1 -0
  93. data/test/test_helper.rb +30 -0
  94. metadata +170 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,92 @@
1
+ MIT-LICENSE
2
+ Manifest
3
+ README.rdoc
4
+ Rakefile
5
+ lib/should_pricot.rb
6
+ lib/should_pricot/count_assertion.rb
7
+ lib/should_pricot/element_assertion.rb
8
+ tasks/should_pricot_tasks.rake
9
+ test/fixtures/posts.yml
10
+ test/fixtures/users.yml
11
+ test/functional/users_controller_test.rb
12
+ test/should_pricot_test.rb
13
+ test/test-app/app/controllers/application_controller.rb
14
+ test/test-app/app/controllers/users_controller.rb
15
+ test/test-app/app/helpers/application_helper.rb
16
+ test/test-app/app/models/post.rb
17
+ test/test-app/app/models/user.rb
18
+ test/test-app/app/views/users/edit.html.erb
19
+ test/test-app/app/views/users/index.html.erb
20
+ test/test-app/app/views/users/new.html.erb
21
+ test/test-app/config/boot.rb
22
+ test/test-app/config/database.yml
23
+ test/test-app/config/environment.rb
24
+ test/test-app/config/environments/test.rb
25
+ test/test-app/config/initializers/funktional.rb
26
+ test/test-app/config/initializers/new_rails_defaults.rb
27
+ test/test-app/config/routes.rb
28
+ test/test-app/db/migrate/001_create_users.rb
29
+ test/test-app/db/migrate/002_create_posts.rb
30
+ test/test-app/public/404.html
31
+ test/test-app/public/422.html
32
+ test/test-app/public/500.html
33
+ test/test-app/script/console
34
+ test/test-app/script/generate
35
+ test/test-app/vendor/plugins/funktional/MIT-LICENSE
36
+ test/test-app/vendor/plugins/funktional/README.rdoc
37
+ test/test-app/vendor/plugins/funktional/Rakefile
38
+ test/test-app/vendor/plugins/funktional/init.rb
39
+ test/test-app/vendor/plugins/funktional/install.rb
40
+ test/test-app/vendor/plugins/funktional/lib/funktional.rb
41
+ test/test-app/vendor/plugins/funktional/lib/funktional/assertion.rb
42
+ test/test-app/vendor/plugins/funktional/lib/funktional/assigned_assertion.rb
43
+ test/test-app/vendor/plugins/funktional/lib/funktional/attribute_test_helper.rb
44
+ test/test-app/vendor/plugins/funktional/lib/funktional/context.rb
45
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/assigned_should_block.rb
46
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/collector.rb
47
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/count_should_block.rb
48
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/delegating_should_block.rb
49
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/element_should_block.rb
50
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/flashed_should_block.rb
51
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_block.rb
52
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_create_block.rb
53
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_delete_block.rb
54
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_block.rb
55
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_create_block.rb
56
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_delete_block.rb
57
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_send_email_block.rb
58
+ test/test-app/vendor/plugins/funktional/lib/funktional/context/stack_recorder.rb
59
+ test/test-app/vendor/plugins/funktional/lib/funktional/email_assertion.rb
60
+ test/test-app/vendor/plugins/funktional/lib/funktional/flashed_assertion.rb
61
+ test/test-app/vendor/plugins/funktional/lib/funktional/model_assertions.rb
62
+ test/test-app/vendor/plugins/funktional/lib/funktional/random_characters.rb
63
+ test/test-app/vendor/plugins/funktional/lib/funktional/recursive_assertion.rb
64
+ test/test-app/vendor/plugins/funktional/lib/funktional/route_checker.rb
65
+ test/test-app/vendor/plugins/funktional/lib/funktional/setup.rb
66
+ test/test-app/vendor/plugins/funktional/lib/funktional/test_class_methods.rb
67
+ test/test-app/vendor/plugins/funktional/lib/funktional/test_instance_methods.rb
68
+ test/test-app/vendor/plugins/funktional/tasks/should_b_tasks.rake
69
+ test/test-app/vendor/plugins/funktional/test/fixtures/posts.yml
70
+ test/test-app/vendor/plugins/funktional/test/fixtures/users.yml
71
+ test/test-app/vendor/plugins/funktional/test/test-app/app/controllers/application_controller.rb
72
+ test/test-app/vendor/plugins/funktional/test/test-app/app/helpers/application_helper.rb
73
+ test/test-app/vendor/plugins/funktional/test/test-app/app/models/post.rb
74
+ test/test-app/vendor/plugins/funktional/test/test-app/app/models/user.rb
75
+ test/test-app/vendor/plugins/funktional/test/test-app/config/boot.rb
76
+ test/test-app/vendor/plugins/funktional/test/test-app/config/database.yml
77
+ test/test-app/vendor/plugins/funktional/test/test-app/config/environment.rb
78
+ test/test-app/vendor/plugins/funktional/test/test-app/config/environments/test.rb
79
+ test/test-app/vendor/plugins/funktional/test/test-app/config/initializers/funktional.rb
80
+ test/test-app/vendor/plugins/funktional/test/test-app/config/initializers/new_rails_defaults.rb
81
+ test/test-app/vendor/plugins/funktional/test/test-app/config/routes.rb
82
+ test/test-app/vendor/plugins/funktional/test/test-app/db/migrate/001_create_users.rb
83
+ test/test-app/vendor/plugins/funktional/test/test-app/db/migrate/002_create_posts.rb
84
+ test/test-app/vendor/plugins/funktional/test/test-app/public/404.html
85
+ test/test-app/vendor/plugins/funktional/test/test-app/public/422.html
86
+ test/test-app/vendor/plugins/funktional/test/test-app/public/500.html
87
+ test/test-app/vendor/plugins/funktional/test/test-app/script/console
88
+ test/test-app/vendor/plugins/funktional/test/test-app/script/generate
89
+ test/test-app/vendor/plugins/funktional/test/test_helper.rb
90
+ test/test-app/vendor/plugins/funktional/test/unit/user_test.rb
91
+ test/test-app/vendor/plugins/funktional/uninstall.rb
92
+ test/test_helper.rb
data/README.rdoc ADDED
@@ -0,0 +1,45 @@
1
+ = ShouldPricot
2
+
3
+ Test the html in your functional tests
4
+ using the wicked Hpricot CSS / XPath selectors.
5
+ Requires Hpricot.
6
+ Designed for use with ActiveSupport::TestCase (Test/Unit)
7
+
8
+ == Example
9
+
10
+ * I want to test something appears on the page:
11
+
12
+ element('h1').should_be_present
13
+
14
+ * I want to test something does not appear:
15
+
16
+ element('#power_user a[@href="/create/havok"]').should_be_missing
17
+
18
+ * I want to check an elements contents:
19
+
20
+ element('.intro p').should_be 'Welcome'
21
+
22
+ * I want to count the number of times something appears:
23
+
24
+ count('ol#girlfriends li').should_be 6
25
+
26
+ * You can also pass a regex
27
+
28
+ element("div.wicked").should_be /containg this/
29
+
30
+ * Even better
31
+
32
+ element('.date').should_contain "today"
33
+
34
+ * You can also pass in html
35
+
36
+ element("div.wicked", some_html).should_be_present
37
+
38
+
39
+ Please refer to the Hpricot library for more examples
40
+ of the kind of selectors available.
41
+
42
+ Mad props to Kid80 for the regex matching patch.
43
+
44
+
45
+ Copyright (c) 2009 [Brent Greeff], released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+ require 'echoe'
6
+
7
+ desc 'Default: run unit tests.'
8
+ task :default => :test
9
+
10
+ desc 'Test the should_pricot plugin.'
11
+ Rake::TestTask.new(:test) do |t|
12
+ t.libs << 'lib'
13
+ t.libs << 'test'
14
+ t.pattern = 'test/**/*_test.rb'
15
+ t.verbose = true
16
+ end
17
+
18
+ desc 'Generate documentation for the should_pricot plugin.'
19
+ Rake::RDocTask.new(:rdoc) do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'ShouldPricot'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
26
+
27
+ Echoe.new('should_pricot', '1.0.0') do |p|
28
+ p.description = "Hpricot powered html testing"
29
+ p.url = "http://github.com/brentgreeff/should_pricot"
30
+ p.author = "Brent Greeff"
31
+ p.email = ""
32
+ p.ignore_pattern = ["init.rb", "install.rb", "uninstall.rb"]
33
+ p.development_dependencies = []
34
+ end
35
+
36
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,19 @@
1
+ module ShouldPricot
2
+
3
+ def element(selector, passed_html = nil)
4
+ @passed_html = passed_html
5
+ ElementAssertion.new(selector, get_html, self)
6
+ end
7
+
8
+ def count(selector, passed_html = nil)
9
+ @passed_html = passed_html
10
+ CountAssertion.new(selector, get_html, self)
11
+ end
12
+
13
+ private
14
+
15
+ def get_html
16
+ return Hpricot(@passed_html) if @passed_html
17
+ @html || @html = Hpricot(@response.body)
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ module ShouldPricot
2
+ class CountAssertion
3
+ def initialize(selector, html, test_instance)
4
+ @test = test_instance
5
+ @elements = (html/selector)
6
+ end
7
+
8
+ def should_be(expected)
9
+ @test.assert_equal expected, @elements.size
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ module ShouldPricot
2
+ class ElementAssertion
3
+ def initialize(selector, html, test_instance)
4
+ @selector = selector
5
+ @test = test_instance
6
+ @element = html.at(selector)
7
+ end
8
+
9
+ def should_be(expected)
10
+ should_be_present
11
+
12
+ if expected.is_a? Regexp
13
+ assert_match expected, @element.inner_html.strip
14
+ else
15
+ assert_equal expected, @element.inner_html.strip
16
+ end
17
+ end
18
+
19
+ def should_contain(expected)
20
+ should_be_present
21
+
22
+ assert_match expected, @element.inner_html.strip
23
+ end
24
+
25
+ def should_be_present
26
+ assert @element.is_a?(Hpricot::Elem), "element : '#{@selector}' is missing"
27
+ end
28
+
29
+ def should_be_missing
30
+ assert @element.nil?, "element : '#{@selector}' is present"
31
+ end
32
+
33
+ private
34
+
35
+ def method_missing(method, *args)
36
+ @test.send method, *args
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{should_pricot}
5
+ s.version = "1.0.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Brent Greeff"]
9
+ s.date = %q{2010-03-07}
10
+ s.description = %q{Hpricot powered html testing}
11
+ s.email = %q{}
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/should_pricot.rb", "lib/should_pricot/count_assertion.rb", "lib/should_pricot/element_assertion.rb", "tasks/should_pricot_tasks.rake"]
13
+ s.files = ["MIT-LICENSE", "README.rdoc", "Rakefile", "lib/should_pricot.rb", "lib/should_pricot/count_assertion.rb", "lib/should_pricot/element_assertion.rb", "tasks/should_pricot_tasks.rake", "test/fixtures/posts.yml", "test/fixtures/users.yml", "test/functional/users_controller_test.rb", "test/should_pricot_test.rb", "test/test-app/app/controllers/application_controller.rb", "test/test-app/app/controllers/users_controller.rb", "test/test-app/app/helpers/application_helper.rb", "test/test-app/app/models/post.rb", "test/test-app/app/models/user.rb", "test/test-app/app/views/users/edit.html.erb", "test/test-app/app/views/users/index.html.erb", "test/test-app/app/views/users/new.html.erb", "test/test-app/config/boot.rb", "test/test-app/config/database.yml", "test/test-app/config/environment.rb", "test/test-app/config/environments/test.rb", "test/test-app/config/initializers/funktional.rb", "test/test-app/config/initializers/new_rails_defaults.rb", "test/test-app/config/routes.rb", "test/test-app/db/migrate/001_create_users.rb", "test/test-app/db/migrate/002_create_posts.rb", "test/test-app/public/404.html", "test/test-app/public/422.html", "test/test-app/public/500.html", "test/test-app/script/console", "test/test-app/script/generate", "test/test-app/vendor/plugins/funktional/MIT-LICENSE", "test/test-app/vendor/plugins/funktional/README.rdoc", "test/test-app/vendor/plugins/funktional/Rakefile", "test/test-app/vendor/plugins/funktional/init.rb", "test/test-app/vendor/plugins/funktional/install.rb", "test/test-app/vendor/plugins/funktional/lib/funktional.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/assertion.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/assigned_assertion.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/attribute_test_helper.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/assigned_should_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/collector.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/count_should_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/delegating_should_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/element_should_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/flashed_should_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_create_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_delete_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_create_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_delete_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/should_not_send_email_block.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/context/stack_recorder.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/email_assertion.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/flashed_assertion.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/model_assertions.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/random_characters.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/recursive_assertion.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/route_checker.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/setup.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/test_class_methods.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/test_instance_methods.rb", "test/test-app/vendor/plugins/funktional/tasks/should_b_tasks.rake", "test/test-app/vendor/plugins/funktional/test/fixtures/posts.yml", "test/test-app/vendor/plugins/funktional/test/fixtures/users.yml", "test/test-app/vendor/plugins/funktional/test/test-app/app/controllers/application_controller.rb", "test/test-app/vendor/plugins/funktional/test/test-app/app/helpers/application_helper.rb", "test/test-app/vendor/plugins/funktional/test/test-app/app/models/post.rb", "test/test-app/vendor/plugins/funktional/test/test-app/app/models/user.rb", "test/test-app/vendor/plugins/funktional/test/test-app/config/boot.rb", "test/test-app/vendor/plugins/funktional/test/test-app/config/database.yml", "test/test-app/vendor/plugins/funktional/test/test-app/config/environment.rb", "test/test-app/vendor/plugins/funktional/test/test-app/config/environments/test.rb", "test/test-app/vendor/plugins/funktional/test/test-app/config/initializers/funktional.rb", "test/test-app/vendor/plugins/funktional/test/test-app/config/initializers/new_rails_defaults.rb", "test/test-app/vendor/plugins/funktional/test/test-app/config/routes.rb", "test/test-app/vendor/plugins/funktional/test/test-app/db/migrate/001_create_users.rb", "test/test-app/vendor/plugins/funktional/test/test-app/db/migrate/002_create_posts.rb", "test/test-app/vendor/plugins/funktional/test/test-app/public/404.html", "test/test-app/vendor/plugins/funktional/test/test-app/public/422.html", "test/test-app/vendor/plugins/funktional/test/test-app/public/500.html", "test/test-app/vendor/plugins/funktional/test/test-app/script/console", "test/test-app/vendor/plugins/funktional/test/test-app/script/generate", "test/test-app/vendor/plugins/funktional/test/test_helper.rb", "test/test-app/vendor/plugins/funktional/test/unit/user_test.rb", "test/test-app/vendor/plugins/funktional/uninstall.rb", "test/test_helper.rb", "Manifest", "should_pricot.gemspec"]
14
+ s.homepage = %q{http://github.com/brentgreeff/should_pricot}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Should_pricot", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{should_pricot}
18
+ s.rubygems_version = %q{1.3.6}
19
+ s.summary = %q{Hpricot powered html testing}
20
+ s.test_files = ["test/functional/users_controller_test.rb", "test/should_pricot_test.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/test_class_methods.rb", "test/test-app/vendor/plugins/funktional/lib/funktional/test_instance_methods.rb", "test/test-app/vendor/plugins/funktional/test/test_helper.rb", "test/test-app/vendor/plugins/funktional/test/unit/user_test.rb", "test/test_helper.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :should_pricot do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,4 @@
1
+ article:
2
+ user: fred
3
+ title: Article
4
+ body: Some body text
@@ -0,0 +1,9 @@
1
+ fred:
2
+ name: fred
3
+ email: fred@funktional.com
4
+ phone: "01234567890"
5
+ age: 35
6
+
7
+ bob:
8
+ name: bob
9
+ email: bob@funktional.com
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UsersControllerTest < ActionController::TestCase
4
+
5
+ fixtures :all
6
+
7
+ context "viewing user index" do
8
+ before { get :index }
9
+
10
+ count("#users li").should_be 2
11
+ element("#users").should_be_present
12
+ element("ul li:first").should_be "bob"
13
+ element("ul li:nth(3)").should_be_missing
14
+ element("section h1").should_contain /users/i
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class ShouldPricotTest < ActionController::TestCase
4
+
5
+
6
+ end
@@ -0,0 +1,10 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ helper :all # include all helpers, all the time
6
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
+
8
+ # Scrub sensitive parameters from your log
9
+ # filter_parameter_logging :password
10
+ end
@@ -0,0 +1,40 @@
1
+ class UsersController < ApplicationController
2
+
3
+ def index
4
+ @users = User.all
5
+ end
6
+
7
+ def new
8
+ @user = User.new
9
+ end
10
+
11
+ def create
12
+ @user = User.new(params[:user])
13
+
14
+ if @user.save
15
+ redirect_to users_url
16
+ else
17
+ flash[:error] = "Something went wrong"
18
+ render :new
19
+ end
20
+ end
21
+
22
+ def edit
23
+ @user = User.find(params[:id])
24
+ end
25
+
26
+ def update
27
+ @user = User.find(params[:id])
28
+
29
+ @user.update_attributes(params[:user])
30
+
31
+ redirect_to users_url
32
+ end
33
+
34
+ def destroy
35
+ @user = User.find(params[:id])
36
+
37
+ @user.destroy
38
+ redirect_to users_url
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ActiveRecord::Base
2
+ belongs_to :user
3
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ has_many :posts
4
+
5
+ validates_presence_of :name
6
+
7
+ end
File without changes
@@ -0,0 +1,9 @@
1
+ <section id="users">
2
+ <h1>All Users</h1>
3
+
4
+ <ul>
5
+ <% for user in @users %>
6
+ <li><%= user.name %></li>
7
+ <% end -%>
8
+ </ul>
9
+ </section>
File without changes