focused_controller 0.1.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.
- data/.gitignore +5 -0
- data/.travis.yml +15 -0
- data/Appraisals +11 -0
- data/Gemfile +4 -0
- data/README.md +1 -0
- data/Rakefile +21 -0
- data/focused_controller.gemspec +30 -0
- data/gemfiles/rails-3-0.gemfile +7 -0
- data/gemfiles/rails-3-1.gemfile +7 -0
- data/gemfiles/rails-3-2.gemfile +7 -0
- data/lib/focused_controller.rb +4 -0
- data/lib/focused_controller/action_name.rb +6 -0
- data/lib/focused_controller/functional_test_helper.rb +25 -0
- data/lib/focused_controller/mixin.rb +44 -0
- data/lib/focused_controller/route.rb +15 -0
- data/lib/focused_controller/route_mapper.rb +58 -0
- data/lib/focused_controller/rspec_controller_class.rb +15 -0
- data/lib/focused_controller/rspec_functional_helper.rb +25 -0
- data/lib/focused_controller/rspec_helper.rb +42 -0
- data/lib/focused_controller/test_helper.rb +183 -0
- data/lib/focused_controller/version.rb +3 -0
- data/test/acceptance/app_test.rb +156 -0
- data/test/app/.gitignore +15 -0
- data/test/app/Gemfile +6 -0
- data/test/app/README.rdoc +261 -0
- data/test/app/Rakefile +7 -0
- data/test/app/app/controllers/application_controller.rb +6 -0
- data/test/app/app/controllers/posts_controller.rb +60 -0
- data/test/app/app/models/.gitkeep +0 -0
- data/test/app/app/models/post.rb +88 -0
- data/test/app/app/views/layouts/application.html.erb +13 -0
- data/test/app/app/views/posts/_form.html.erb +31 -0
- data/test/app/app/views/posts/edit.html.erb +6 -0
- data/test/app/app/views/posts/index.html.erb +23 -0
- data/test/app/app/views/posts/new.html.erb +5 -0
- data/test/app/app/views/posts/show.html.erb +8 -0
- data/test/app/config.ru +4 -0
- data/test/app/config/application.rb +16 -0
- data/test/app/config/boot.rb +6 -0
- data/test/app/config/environment.rb +5 -0
- data/test/app/config/environments/development.rb +21 -0
- data/test/app/config/environments/test.rb +29 -0
- data/test/app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/app/config/initializers/inflections.rb +15 -0
- data/test/app/config/initializers/mime_types.rb +5 -0
- data/test/app/config/initializers/secret_token.rb +7 -0
- data/test/app/config/initializers/session_store.rb +8 -0
- data/test/app/config/locales/en.yml +5 -0
- data/test/app/config/routes.rb +62 -0
- data/test/app/db/seeds.rb +7 -0
- data/test/app/doc/README_FOR_APP +2 -0
- data/test/app/lib/assets/.gitkeep +0 -0
- data/test/app/lib/tasks/.gitkeep +0 -0
- data/test/app/log/.gitkeep +0 -0
- data/test/app/public/404.html +26 -0
- data/test/app/public/422.html +26 -0
- data/test/app/public/500.html +25 -0
- data/test/app/public/favicon.ico +0 -0
- data/test/app/public/index.html +241 -0
- data/test/app/public/javascripts/application.js +9663 -0
- data/test/app/public/robots.txt +5 -0
- data/test/app/public/stylesheets/application.css +83 -0
- data/test/app/script/rails +6 -0
- data/test/app/spec/controllers/posts_controller_spec.rb +59 -0
- data/test/app/spec/isolated_spec_helper.rb +9 -0
- data/test/app/spec/spec_helper.rb +5 -0
- data/test/app/spec/unit/controllers/posts_controller_isolated_spec.rb +60 -0
- data/test/app/spec/unit/controllers/posts_controller_spec.rb +59 -0
- data/test/app/test/functional/.gitkeep +0 -0
- data/test/app/test/functional/posts_controller_test.rb +67 -0
- data/test/app/test/isolated_test_helper.rb +10 -0
- data/test/app/test/test_helper.rb +6 -0
- data/test/app/test/unit/.gitkeep +0 -0
- data/test/app/test/unit/controllers/posts_controller_isolated_test.rb +69 -0
- data/test/app/test/unit/controllers/posts_controller_test.rb +67 -0
- data/test/app/vendor/assets/javascripts/.gitkeep +0 -0
- data/test/app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/app/vendor/plugins/.gitkeep +0 -0
- data/test/helper.rb +33 -0
- data/test/unit/functional_test_helper_test.rb +65 -0
- data/test/unit/mixin_test.rb +70 -0
- data/test/unit/route_mapper_test.rb +73 -0
- data/test/unit/route_test.rb +39 -0
- data/test/unit/rspec_functional_helper.rb +42 -0
- data/test/unit/rspec_helper_test.rb +91 -0
- data/test/unit/test_helper_test.rb +235 -0
- metadata +285 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
/* This is a static file. It was exported so we don't have to depend on
|
2
|
+
* the asset pipeline, so we can run the app against Rails 3.0 too. */
|
3
|
+
|
4
|
+
/* line 1, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
5
|
+
body {
|
6
|
+
background-color: #fff;
|
7
|
+
color: #333;
|
8
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
line-height: 18px;
|
11
|
+
}
|
12
|
+
|
13
|
+
/* line 8, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
14
|
+
p, ol, ul, td {
|
15
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
16
|
+
font-size: 13px;
|
17
|
+
line-height: 18px;
|
18
|
+
}
|
19
|
+
|
20
|
+
/* line 13, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
21
|
+
pre {
|
22
|
+
background-color: #eee;
|
23
|
+
padding: 10px;
|
24
|
+
font-size: 11px;
|
25
|
+
}
|
26
|
+
|
27
|
+
/* line 18, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
28
|
+
a {
|
29
|
+
color: #000;
|
30
|
+
}
|
31
|
+
/* line 20, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
32
|
+
a:visited {
|
33
|
+
color: #666;
|
34
|
+
}
|
35
|
+
/* line 22, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
36
|
+
a:hover {
|
37
|
+
color: #fff;
|
38
|
+
background-color: #000;
|
39
|
+
}
|
40
|
+
|
41
|
+
/* line 27, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
42
|
+
div.field, div.actions {
|
43
|
+
margin-bottom: 10px;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* line 30, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
47
|
+
#notice {
|
48
|
+
color: green;
|
49
|
+
}
|
50
|
+
|
51
|
+
/* line 33, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
52
|
+
.field_with_errors {
|
53
|
+
padding: 2px;
|
54
|
+
background-color: red;
|
55
|
+
display: table;
|
56
|
+
}
|
57
|
+
|
58
|
+
/* line 38, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
59
|
+
#error_explanation {
|
60
|
+
width: 450px;
|
61
|
+
border: 2px solid red;
|
62
|
+
padding: 7px;
|
63
|
+
padding-bottom: 0;
|
64
|
+
margin-bottom: 20px;
|
65
|
+
background-color: #f0f0f0;
|
66
|
+
}
|
67
|
+
/* line 45, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
68
|
+
#error_explanation h2 {
|
69
|
+
text-align: left;
|
70
|
+
font-weight: bold;
|
71
|
+
padding: 5px 5px 5px 15px;
|
72
|
+
font-size: 12px;
|
73
|
+
margin: -7px;
|
74
|
+
margin-bottom: 0px;
|
75
|
+
background-color: #c00;
|
76
|
+
color: #fff;
|
77
|
+
}
|
78
|
+
/* line 54, /home/turnip/Code/focused_controller/test/app/app/assets/stylesheets/scaffolds.css.scss */
|
79
|
+
#error_explanation ul li {
|
80
|
+
font-size: 12px;
|
81
|
+
list-style: square;
|
82
|
+
}
|
83
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PostsController do
|
4
|
+
include FocusedController::RSpecFunctionalHelper
|
5
|
+
|
6
|
+
before do
|
7
|
+
@post = Post.create(:title => 'Hello', :body => 'Omg')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe PostsController::Index do
|
11
|
+
it "should get index" do
|
12
|
+
get
|
13
|
+
response.should be_success
|
14
|
+
subject.posts.should_not be_nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe PostsController::New do
|
19
|
+
it "should get new" do
|
20
|
+
get
|
21
|
+
response.should be_success
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe PostsController::Create do
|
26
|
+
it "should create post" do
|
27
|
+
expect { post :post => @post.attributes }.to change(Post, :count).by(1)
|
28
|
+
response.should redirect_to(post_path(subject.post))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe PostsController::Show do
|
33
|
+
it "should show post" do
|
34
|
+
get :id => @post.id
|
35
|
+
response.should be_success
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe PostsController::Edit do
|
40
|
+
it "should get edit" do
|
41
|
+
get :id => @post.id
|
42
|
+
response.should be_success
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe PostsController::Update do
|
47
|
+
it "should update post" do
|
48
|
+
put :id => @post.id, :post => @post.attributes
|
49
|
+
response.should redirect_to(post_path(subject.post))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe PostsController::Destroy do
|
54
|
+
it "should destroy post" do
|
55
|
+
expect { delete :id => @post.id }.to change(Post, :count).by(-1)
|
56
|
+
response.should redirect_to(posts_path)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rspec'
|
3
|
+
require 'focused_controller/rspec_helper'
|
4
|
+
require 'focused_controller/rspec_functional_helper'
|
5
|
+
|
6
|
+
require 'active_support/dependencies'
|
7
|
+
ActiveSupport::Dependencies.autoload_paths += Dir[File.expand_path('../../app/*', __FILE__)]
|
8
|
+
|
9
|
+
POSTS = []
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'isolated_spec_helper'
|
2
|
+
|
3
|
+
describe PostsController do
|
4
|
+
include FocusedController::RSpecHelper
|
5
|
+
stub_url :post, :posts
|
6
|
+
|
7
|
+
before do
|
8
|
+
@post = Post.create(:title => 'Hello', :body => 'Omg')
|
9
|
+
end
|
10
|
+
|
11
|
+
describe PostsController::Index do
|
12
|
+
it "should get index" do
|
13
|
+
req
|
14
|
+
response.should be_success
|
15
|
+
subject.posts.should_not be(:nil)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe PostsController::New do
|
20
|
+
it "should get new" do
|
21
|
+
req
|
22
|
+
response.should be_success
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe PostsController::Create do
|
27
|
+
it "should create post" do
|
28
|
+
expect { req :post => @post.attributes }.to change(Post, :count).by(1)
|
29
|
+
response.should redirect_to(post_url(subject.post))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe PostsController::Show do
|
34
|
+
it "should show post" do
|
35
|
+
req :id => @post.id
|
36
|
+
response.should be_success
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe PostsController::Edit do
|
41
|
+
it "should get edit" do
|
42
|
+
req :id => @post.id
|
43
|
+
response.should be_success
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe PostsController::Update do
|
48
|
+
it "should update post" do
|
49
|
+
req :id => @post.id
|
50
|
+
response.should redirect_to(post_url(subject.post))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe PostsController::Destroy do
|
55
|
+
it "should destroy post" do
|
56
|
+
expect { req :id => @post.id }.to change(Post, :count).by(-1)
|
57
|
+
response.should redirect_to(posts_url)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PostsController do
|
4
|
+
include FocusedController::RSpecHelper
|
5
|
+
|
6
|
+
before do
|
7
|
+
@post = Post.create(:title => 'Hello', :body => 'Omg')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe PostsController::Index do
|
11
|
+
it "should get index" do
|
12
|
+
req
|
13
|
+
response.should be_success
|
14
|
+
subject.posts.should_not be(:nil)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe PostsController::New do
|
19
|
+
it "should get new" do
|
20
|
+
req
|
21
|
+
response.should be_success
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe PostsController::Create do
|
26
|
+
it "should create post" do
|
27
|
+
expect { req :post => @post.attributes }.to change(Post, :count).by(1)
|
28
|
+
response.should redirect_to(post_path(subject.post))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe PostsController::Show do
|
33
|
+
it "should show post" do
|
34
|
+
req :id => @post.id
|
35
|
+
response.should be_success
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe PostsController::Edit do
|
40
|
+
it "should get edit" do
|
41
|
+
req :id => @post.id
|
42
|
+
response.should be_success
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe PostsController::Update do
|
47
|
+
it "should update post" do
|
48
|
+
req :id => @post.id
|
49
|
+
response.should redirect_to(post_path(subject.post))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe PostsController::Destroy do
|
54
|
+
it "should destroy post" do
|
55
|
+
expect { req :id => @post.id }.to change(Post, :count).by(-1)
|
56
|
+
response.should redirect_to(posts_path)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class PostsController
|
4
|
+
class TestCase < ActionController::TestCase
|
5
|
+
include FocusedController::FunctionalTestHelper
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@post = Post.create(:title => 'Hello', :body => 'Omg')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class IndexTest < TestCase
|
13
|
+
test "should get index" do
|
14
|
+
get
|
15
|
+
assert_response :success
|
16
|
+
assert_not_nil @controller.posts
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class NewTest < TestCase
|
21
|
+
test "should get new" do
|
22
|
+
get
|
23
|
+
assert_response :success
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class CreateTest < TestCase
|
28
|
+
test "should create post" do
|
29
|
+
assert_difference('Post.count') do
|
30
|
+
post :post => @post.attributes
|
31
|
+
end
|
32
|
+
|
33
|
+
assert_redirected_to post_path(@controller.post)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class ShowTest < TestCase
|
38
|
+
test "should show post" do
|
39
|
+
get :id => @post.id
|
40
|
+
assert_response :success
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class EditTest < TestCase
|
45
|
+
test "should get edit" do
|
46
|
+
get :id => @post.id
|
47
|
+
assert_response :success
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class UpdateTest < TestCase
|
52
|
+
test "should update post" do
|
53
|
+
put :id => @post.id, :post => @post.attributes
|
54
|
+
assert_redirected_to post_path(@controller.post)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class DestroyTest < TestCase
|
59
|
+
test "should destroy post" do
|
60
|
+
assert_difference('Post.count', -1) do
|
61
|
+
delete :id => @post.id
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_redirected_to posts_path
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'active_support/test_case'
|
4
|
+
require 'focused_controller/functional_test_helper'
|
5
|
+
require 'focused_controller/test_helper'
|
6
|
+
|
7
|
+
require 'active_support/dependencies'
|
8
|
+
ActiveSupport::Dependencies.autoload_paths += Dir[File.expand_path('../../app/*', __FILE__)]
|
9
|
+
|
10
|
+
POSTS = []
|
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'isolated_test_helper'
|
2
|
+
require_dependency 'posts_controller'
|
3
|
+
|
4
|
+
class PostsController
|
5
|
+
class TestCase < ActiveSupport::TestCase
|
6
|
+
include FocusedController::TestHelper
|
7
|
+
stub_url :post, :posts
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@post = Post.create(:title => 'Hello', :body => 'Omg')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class IndexTest < TestCase
|
15
|
+
test "should get index" do
|
16
|
+
req
|
17
|
+
assert_response :success
|
18
|
+
assert_not_nil controller.posts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class NewTest < TestCase
|
23
|
+
test "should get new" do
|
24
|
+
req
|
25
|
+
assert_response :success
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class CreateTest < TestCase
|
30
|
+
test "should create post" do
|
31
|
+
assert_difference('Post.count') do
|
32
|
+
req :post => @post.attributes
|
33
|
+
end
|
34
|
+
|
35
|
+
assert_redirected_to post_url(controller.post)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class ShowTest < TestCase
|
40
|
+
test "should show post" do
|
41
|
+
req :id => @post.id
|
42
|
+
assert_response :success
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class EditTest < TestCase
|
47
|
+
test "should get edit" do
|
48
|
+
req :id => @post.id
|
49
|
+
assert_response :success
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class UpdateTest < TestCase
|
54
|
+
test "should update post" do
|
55
|
+
req :id => @post.id
|
56
|
+
assert_redirected_to post_url(controller.post)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class DestroyTest < TestCase
|
61
|
+
test "should destroy post" do
|
62
|
+
assert_difference('Post.count', -1) do
|
63
|
+
req :id => @post.id
|
64
|
+
end
|
65
|
+
|
66
|
+
assert_redirected_to posts_url
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|