funktional 1.0.0 → 2.0.2

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/README.rdoc CHANGED
@@ -3,13 +3,13 @@
3
3
  == A Rails testing framework with a railsy syntax
4
4
 
5
5
  == Install
6
- * Use braid to install, if you don't have it.
7
- sudo gem install braid
8
-
9
- * Then
6
+ * Via the gem
7
+ gem install funktional
10
8
 
9
+ * With braid
11
10
  braid add git://github.com/brentgreeff/funktional.git -p
12
11
 
12
+
13
13
  * add a setup line to 'test/test_helper.rb'
14
14
 
15
15
  class ActiveSupport::TestCase
data/funktional.gemspec CHANGED
@@ -2,27 +2,121 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{funktional}
5
- s.version = "1.0.0"
6
-
5
+ s.version = "2.0.2"
6
+
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Brent Greeff and Felix Clack"]
9
9
  s.date = %q{2010-03-06}
10
10
  s.description = %q{Alternative test/unit framework}
11
- s.email = %q{felixclack@gmail.com}
12
- s.extra_rdoc_files = ["README.rdoc", "lib/funktional.rb", "lib/funktional/assertion.rb", "lib/funktional/assigned_assertion.rb", "lib/funktional/attribute_test_helper.rb", "lib/funktional/context.rb", "lib/funktional/context/assigned_should_block.rb", "lib/funktional/context/collector.rb", "lib/funktional/context/count_should_block.rb", "lib/funktional/context/delegating_should_block.rb", "lib/funktional/context/element_should_block.rb", "lib/funktional/context/flashed_should_block.rb", "lib/funktional/context/should_block.rb", "lib/funktional/context/should_create_block.rb", "lib/funktional/context/should_delete_block.rb", "lib/funktional/context/should_not_block.rb", "lib/funktional/context/should_not_create_block.rb", "lib/funktional/context/should_not_delete_block.rb", "lib/funktional/context/should_not_send_email_block.rb", "lib/funktional/context/stack_recorder.rb", "lib/funktional/email_assertion.rb", "lib/funktional/flashed_assertion.rb", "lib/funktional/model_assertions.rb", "lib/funktional/random_characters.rb", "lib/funktional/recursive_assertion.rb", "lib/funktional/route_checker.rb", "lib/funktional/setup.rb", "lib/funktional/test_class_methods.rb", "lib/funktional/test_instance_methods.rb", "tasks/should_b_tasks.rake"]
13
- s.files = ["MIT-LICENSE", "Manifest", "README.rdoc", "Rakefile", "lib/funktional.rb", "lib/funktional/assertion.rb", "lib/funktional/assigned_assertion.rb", "lib/funktional/attribute_test_helper.rb", "lib/funktional/context.rb", "lib/funktional/context/assigned_should_block.rb", "lib/funktional/context/collector.rb", "lib/funktional/context/count_should_block.rb", "lib/funktional/context/delegating_should_block.rb", "lib/funktional/context/element_should_block.rb", "lib/funktional/context/flashed_should_block.rb", "lib/funktional/context/should_block.rb", "lib/funktional/context/should_create_block.rb", "lib/funktional/context/should_delete_block.rb", "lib/funktional/context/should_not_block.rb", "lib/funktional/context/should_not_create_block.rb", "lib/funktional/context/should_not_delete_block.rb", "lib/funktional/context/should_not_send_email_block.rb", "lib/funktional/context/stack_recorder.rb", "lib/funktional/email_assertion.rb", "lib/funktional/flashed_assertion.rb", "lib/funktional/model_assertions.rb", "lib/funktional/random_characters.rb", "lib/funktional/recursive_assertion.rb", "lib/funktional/route_checker.rb", "lib/funktional/setup.rb", "lib/funktional/test_class_methods.rb", "lib/funktional/test_instance_methods.rb", "tasks/should_b_tasks.rake", "test/fixtures/posts.yml", "test/fixtures/users.yml", "test/functional/users_controller_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_helper.rb", "test/unit/user_test.rb", "funktional.gemspec"]
11
+ s.email = %q{email@brentgreeff.com}
12
+ s.extra_rdoc_files = [
13
+ "README.rdoc",
14
+ "lib/funktional.rb",
15
+ "lib/funktional/assertion.rb",
16
+ "lib/funktional/assigned_assertion.rb",
17
+ "lib/funktional/attribute_test_helper.rb",
18
+ "lib/funktional/context.rb",
19
+ "lib/funktional/context/assigned_should_block.rb",
20
+ "lib/funktional/context/collector.rb",
21
+ "lib/funktional/context/count_should_block.rb",
22
+ "lib/funktional/context/delegating_should_block.rb",
23
+ "lib/funktional/context/element_should_block.rb",
24
+ "lib/funktional/context/flashed_should_block.rb",
25
+ "lib/funktional/context/should_block.rb",
26
+ "lib/funktional/context/should_create_block.rb",
27
+ "lib/funktional/context/should_delete_block.rb",
28
+ "lib/funktional/context/should_not_block.rb",
29
+ "lib/funktional/context/should_not_create_block.rb",
30
+ "lib/funktional/context/should_not_delete_block.rb",
31
+ "lib/funktional/context/should_not_send_email_block.rb",
32
+ "lib/funktional/context/stack_recorder.rb",
33
+ "lib/funktional/email_assertion.rb",
34
+ "lib/funktional/flashed_assertion.rb",
35
+ "lib/funktional/model_assertions.rb",
36
+ "lib/funktional/random_characters.rb",
37
+ "lib/funktional/recursive_assertion.rb",
38
+ "lib/funktional/route_checker.rb",
39
+ "lib/funktional/setup.rb",
40
+ "lib/funktional/test_class_methods.rb",
41
+ "lib/funktional/test_instance_methods.rb"
42
+ ]
43
+ s.files = [
44
+ "MIT-LICENSE",
45
+ "README.rdoc",
46
+ "Rakefile",
47
+ "lib/funktional.rb",
48
+ "lib/funktional/assertion.rb",
49
+ "lib/funktional/assigned_assertion.rb",
50
+ "lib/funktional/attribute_test_helper.rb",
51
+ "lib/funktional/context.rb",
52
+ "lib/funktional/context/assigned_should_block.rb",
53
+ "lib/funktional/context/collector.rb",
54
+ "lib/funktional/context/count_should_block.rb",
55
+ "lib/funktional/context/delegating_should_block.rb",
56
+ "lib/funktional/context/element_should_block.rb",
57
+ "lib/funktional/context/flashed_should_block.rb",
58
+ "lib/funktional/context/should_block.rb",
59
+ "lib/funktional/context/should_create_block.rb",
60
+ "lib/funktional/context/should_delete_block.rb",
61
+ "lib/funktional/context/should_not_block.rb",
62
+ "lib/funktional/context/should_not_create_block.rb",
63
+ "lib/funktional/context/should_not_delete_block.rb",
64
+ "lib/funktional/context/should_not_send_email_block.rb",
65
+ "lib/funktional/context/stack_recorder.rb",
66
+ "lib/funktional/email_assertion.rb",
67
+ "lib/funktional/flashed_assertion.rb",
68
+ "lib/funktional/model_assertions.rb",
69
+ "lib/funktional/random_characters.rb",
70
+ "lib/funktional/recursive_assertion.rb",
71
+ "lib/funktional/route_checker.rb",
72
+ "lib/funktional/setup.rb",
73
+ "lib/funktional/test_class_methods.rb",
74
+ "lib/funktional/test_instance_methods.rb",
75
+ "test/fixtures/posts.yml",
76
+ "test/fixtures/users.yml",
77
+ "test/functional/users_controller_test.rb",
78
+ "test/test-app/app/controllers/application_controller.rb",
79
+ "test/test-app/app/controllers/users_controller.rb",
80
+ "test/test-app/app/helpers/application_helper.rb",
81
+ "test/test-app/app/models/post.rb",
82
+ "test/test-app/app/models/user.rb",
83
+ "test/test-app/app/views/users/edit.html.erb",
84
+ "test/test-app/app/views/users/index.html.erb",
85
+ "test/test-app/app/views/users/new.html.erb",
86
+ "test/test-app/config/boot.rb",
87
+ "test/test-app/config/database.yml",
88
+ "test/test-app/config/environment.rb",
89
+ "test/test-app/config/environments/test.rb",
90
+ "test/test-app/config/initializers/funktional.rb",
91
+ "test/test-app/config/initializers/new_rails_defaults.rb",
92
+ "test/test-app/config/routes.rb",
93
+ "test/test-app/db/migrate/001_create_users.rb",
94
+ "test/test-app/db/migrate/002_create_posts.rb",
95
+ "test/test-app/public/404.html",
96
+ "test/test-app/public/422.html",
97
+ "test/test-app/public/500.html",
98
+ "test/test-app/script/console",
99
+ "test/test-app/script/generate",
100
+ "test/test_helper.rb",
101
+ "test/unit/user_test.rb",
102
+ "funktional.gemspec"
103
+ ]
14
104
  s.homepage = %q{http://github.com/brentgreeff/funktional}
15
105
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Funktional", "--main", "README.rdoc"]
16
106
  s.require_paths = ["lib"]
17
107
  s.rubyforge_project = %q{funktional}
18
108
  s.rubygems_version = %q{1.3.6}
19
109
  s.summary = %q{Alternative test/unit framework}
20
- s.test_files = ["test/functional/users_controller_test.rb", "test/test_helper.rb", "test/unit/user_test.rb"]
21
-
110
+ s.test_files = [
111
+ "test/functional/users_controller_test.rb",
112
+ "test/test_helper.rb",
113
+ "test/unit/user_test.rb"
114
+ ]
115
+
22
116
  if s.respond_to? :specification_version then
23
117
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
118
  s.specification_version = 3
25
-
119
+
26
120
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
121
  else
28
122
  end
@@ -12,7 +12,7 @@ module Funktional
12
12
  if result.nil?
13
13
  result = assigned(recorder.__target).send(meth, *args, &block)
14
14
  else
15
- result.send(meth, *args)
15
+ result.send(meth, *args, &block)
16
16
  end
17
17
  end
18
18
  end
@@ -8,7 +8,11 @@ module Funktional
8
8
  @test.assert_respond_to @assigned, @method
9
9
  end
10
10
 
11
- def should_be(expected_value)
11
+ def should_be(expected_value=nil, &block)
12
+ if block_given?
13
+ expected_value ||= block.bind(@test).call
14
+ end
15
+
12
16
  value = @assigned.send @method
13
17
  @test.assert_equal expected_value, value
14
18
  end
@@ -88,7 +88,15 @@ module Funktional
88
88
 
89
89
  def should_redirect_to(uri)
90
90
  _wrap_assertion do
91
- assert_response :redirect
91
+ actual_template = @response.rendered[:template].to_s
92
+
93
+ if actual_template.blank?
94
+ msg = "redirected to [#{@response.redirected_to}]"
95
+ else
96
+ msg = "rendered template [#{actual_template}]"
97
+ end
98
+
99
+ assert_response :redirect, msg
92
100
  assert_redirected_to uri
93
101
  end
94
102
  end
data/lib/funktional.rb CHANGED
@@ -40,3 +40,8 @@ ActiveSupport::TestCase.send(:include, Funktional::AttributeTestHelper)
40
40
 
41
41
  ActiveSupport::TestCase.send(:include, Funktional::Setup)
42
42
 
43
+ if RAILS_ENV.eql? 'test' or $0 == 'irb'
44
+ require 'funktional/random_characters'
45
+ Integer.send :include, Funktional::RandomCharacters
46
+ end
47
+
@@ -39,6 +39,8 @@ class UsersControllerTest < ActionController::TestCase
39
39
  should "still be able to assign variable in instance version" do
40
40
  assigned(User).should_be @user
41
41
  end
42
+
43
+ assigned(User).name.should_be { @user.name }
42
44
  end
43
45
 
44
46
  context "updating the user" do
@@ -47,6 +49,12 @@ class UsersControllerTest < ActionController::TestCase
47
49
  should_not :create => User
48
50
  assigned(User).name.should_be "demo"
49
51
  end
52
+
53
+ context "deleting the user" do
54
+ before { delete :destroy, :id => @user.to_param }
55
+
56
+ should :delete => User
57
+ end
50
58
  end
51
59
 
52
60
  private
@@ -30,4 +30,11 @@ class UsersController < ApplicationController
30
30
 
31
31
  redirect_to users_url
32
32
  end
33
+
34
+ def destroy
35
+ @user = User.find(params[:id])
36
+
37
+ @user.destroy
38
+ redirect_to users_url
39
+ end
33
40
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funktional
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 11
4
5
  prerelease: false
5
6
  segments:
6
- - 1
7
+ - 2
7
8
  - 0
8
- - 0
9
- version: 1.0.0
9
+ - 2
10
+ version: 2.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Brent Greeff and Felix Clack
@@ -19,7 +20,7 @@ default_executable:
19
20
  dependencies: []
20
21
 
21
22
  description: Alternative test/unit framework
22
- email: felixclack@gmail.com
23
+ email: email@brentgreeff.com
23
24
  executables: []
24
25
 
25
26
  extensions: []
@@ -54,10 +55,8 @@ extra_rdoc_files:
54
55
  - lib/funktional/setup.rb
55
56
  - lib/funktional/test_class_methods.rb
56
57
  - lib/funktional/test_instance_methods.rb
57
- - tasks/should_b_tasks.rake
58
58
  files:
59
59
  - MIT-LICENSE
60
- - Manifest
61
60
  - README.rdoc
62
61
  - Rakefile
63
62
  - lib/funktional.rb
@@ -88,7 +87,6 @@ files:
88
87
  - lib/funktional/setup.rb
89
88
  - lib/funktional/test_class_methods.rb
90
89
  - lib/funktional/test_instance_methods.rb
91
- - tasks/should_b_tasks.rake
92
90
  - test/fixtures/posts.yml
93
91
  - test/fixtures/users.yml
94
92
  - test/functional/users_controller_test.rb
@@ -132,16 +130,20 @@ rdoc_options:
132
130
  require_paths:
133
131
  - lib
134
132
  required_ruby_version: !ruby/object:Gem::Requirement
133
+ none: false
135
134
  requirements:
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
137
+ hash: 3
138
138
  segments:
139
139
  - 0
140
140
  version: "0"
141
141
  required_rubygems_version: !ruby/object:Gem::Requirement
142
+ none: false
142
143
  requirements:
143
144
  - - ">="
144
145
  - !ruby/object:Gem::Version
146
+ hash: 11
145
147
  segments:
146
148
  - 1
147
149
  - 2
@@ -149,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
151
  requirements: []
150
152
 
151
153
  rubyforge_project: funktional
152
- rubygems_version: 1.3.6
154
+ rubygems_version: 1.3.7
153
155
  signing_key:
154
156
  specification_version: 3
155
157
  summary: Alternative test/unit framework
data/Manifest DELETED
@@ -1,60 +0,0 @@
1
- MIT-LICENSE
2
- Manifest
3
- README.rdoc
4
- Rakefile
5
- lib/funktional.rb
6
- lib/funktional/assertion.rb
7
- lib/funktional/assigned_assertion.rb
8
- lib/funktional/attribute_test_helper.rb
9
- lib/funktional/context.rb
10
- lib/funktional/context/assigned_should_block.rb
11
- lib/funktional/context/collector.rb
12
- lib/funktional/context/count_should_block.rb
13
- lib/funktional/context/delegating_should_block.rb
14
- lib/funktional/context/element_should_block.rb
15
- lib/funktional/context/flashed_should_block.rb
16
- lib/funktional/context/should_block.rb
17
- lib/funktional/context/should_create_block.rb
18
- lib/funktional/context/should_delete_block.rb
19
- lib/funktional/context/should_not_block.rb
20
- lib/funktional/context/should_not_create_block.rb
21
- lib/funktional/context/should_not_delete_block.rb
22
- lib/funktional/context/should_not_send_email_block.rb
23
- lib/funktional/context/stack_recorder.rb
24
- lib/funktional/email_assertion.rb
25
- lib/funktional/flashed_assertion.rb
26
- lib/funktional/model_assertions.rb
27
- lib/funktional/random_characters.rb
28
- lib/funktional/recursive_assertion.rb
29
- lib/funktional/route_checker.rb
30
- lib/funktional/setup.rb
31
- lib/funktional/test_class_methods.rb
32
- lib/funktional/test_instance_methods.rb
33
- tasks/should_b_tasks.rake
34
- test/fixtures/posts.yml
35
- test/fixtures/users.yml
36
- test/functional/users_controller_test.rb
37
- test/test-app/app/controllers/application_controller.rb
38
- test/test-app/app/controllers/users_controller.rb
39
- test/test-app/app/helpers/application_helper.rb
40
- test/test-app/app/models/post.rb
41
- test/test-app/app/models/user.rb
42
- test/test-app/app/views/users/edit.html.erb
43
- test/test-app/app/views/users/index.html.erb
44
- test/test-app/app/views/users/new.html.erb
45
- test/test-app/config/boot.rb
46
- test/test-app/config/database.yml
47
- test/test-app/config/environment.rb
48
- test/test-app/config/environments/test.rb
49
- test/test-app/config/initializers/funktional.rb
50
- test/test-app/config/initializers/new_rails_defaults.rb
51
- test/test-app/config/routes.rb
52
- test/test-app/db/migrate/001_create_users.rb
53
- test/test-app/db/migrate/002_create_posts.rb
54
- test/test-app/public/404.html
55
- test/test-app/public/422.html
56
- test/test-app/public/500.html
57
- test/test-app/script/console
58
- test/test-app/script/generate
59
- test/test_helper.rb
60
- test/unit/user_test.rb
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :should_b do
3
- # # Task goes here
4
- # end