echo_base 0.1.3 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -2
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.rdoc +32 -32
- data/Rakefile +51 -40
- data/bin/echo_base +7 -0
- data/echo_base.gemspec +150 -134
- data/lib/echo_base.rb +122 -0
- data/lib/{generators/echo_base/templates → templates}/Capfile +0 -0
- data/lib/{generators/echo_base/templates → templates}/Gemfile +8 -6
- data/lib/{generators/echo_base/templates → templates}/app/controllers/application_controller.rb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/controllers/sessions_controller.rb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/controllers/users_controller.rb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/models/authorization.rb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/models/user.rb +0 -0
- data/lib/{generators/echo_base/templates/application.html.erb → templates/app/views/layouts/application.html.erb.tt} +4 -3
- data/lib/{generators/echo_base/templates → templates}/app/views/shared/_js.html.erb +2 -3
- data/lib/{generators/echo_base/templates → templates}/app/views/users/_form.html.erb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/views/users/_sidebar.html.erb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/views/users/edit.html.erb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/views/users/index.html.erb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/views/users/new.html.erb +0 -0
- data/lib/{generators/echo_base/templates → templates}/app/views/users/show.html.erb +0 -0
- data/lib/{generators/echo_base/templates → templates}/config/deploy.rb +0 -0
- data/lib/{generators/echo_base/templates → templates}/config/initializers/hoptoad.rb +0 -1
- data/lib/{generators/echo_base/templates → templates}/config/initializers/omniauth.rb +0 -0
- data/lib/{generators/echo_base/templates/public/favicon.ico → templates/config/newrelic.yml.example} +0 -0
- data/lib/{generators/echo_base/templates → templates}/config/omniauth.yml +0 -0
- data/lib/templates/config/omniauth.yml.example +62 -0
- data/lib/{generators/echo_base/templates → templates}/db/migrate/20101008210657_create_authorizations.rb +0 -0
- data/lib/{generators/echo_base/templates → templates}/db/migrate/20101009192412_create_users.rb +0 -0
- data/lib/templates/gitignore +17 -0
- data/lib/{generators/echo_base/templates → templates}/public/404.html +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/422.html +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/500.html +0 -0
- data/lib/{generators/echo_base/templates/public/stylesheets/.gitkeep → templates/public/favicon.ico} +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/arrow.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/avatar.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/boxbar-background.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/breadcrumb.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/button-background-active.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/button-background.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/about +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/anchor-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/anchor.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/cross-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/cross.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/download-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/download.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/edit-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/edit.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/export-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/export.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/show-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/24/show.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/add.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/application_edit.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/calendar-hover.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/calendar.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/cross.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/delete.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/download.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/edit.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/key.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/pdf.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/search.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/see-less.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/see-more.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/send-mail.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/show.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/source +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/tick.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/icons/upload.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/logo.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/menubar-background.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/search-button.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/session/account.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/session/config.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/session/home.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/session/logout.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/images/web-app-theme/tipsy.gif +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/javascripts/application.js +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/javascripts/dd_belatedpng.js +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/javascripts/jquery-1.4.2.min.js +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/javascripts/modernizr-1.5.min.js +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/javascripts/rails.js +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/robots.txt +0 -0
- data/lib/templates/public/stylesheets/.gitkeep +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/handheld.css +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/style.css +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/base.css +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/override.css +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/themes/default/images/arrow.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/themes/default/images/boxbar-background.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/themes/default/images/button-background-active.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/themes/default/images/button-background.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/themes/default/images/menubar-background.png +0 -0
- data/lib/{generators/echo_base/templates → templates}/public/stylesheets/web-app-theme/themes/default/style.css +0 -0
- data/spec/echo_base_spec.rb +77 -0
- data/spec/spec_helper.rb +12 -0
- metadata +314 -138
- data/.gitignore +0 -21
- data/VERSION +0 -1
- data/lib/generators/echo_base/USAGE +0 -5
- data/lib/generators/echo_base/echo_base_generator.rb +0 -51
- data/lib/generators/echo_base/templates/.infinity_test +0 -25
- data/lib/generators/echo_base/templates/.rspec +0 -1
- data/lib/generators/echo_base/templates/.rvmrc +0 -1
- data/lib/generators/echo_base/templates/app/helpers/application_helper.rb +0 -2
- data/lib/generators/echo_base/templates/app/helpers/sessions_helper.rb +0 -2
- data/lib/generators/echo_base/templates/app/helpers/users_helper.rb +0 -2
- data/lib/generators/echo_base/templates/autotest/discover.rb +0 -2
- data/lib/generators/echo_base/templates/config/cucumber.yml +0 -8
- data/lib/generators/echo_base/templates/config/newrelic.yml +0 -1
- data/lib/generators/echo_base/templates/features/manage_authentications.feature +0 -45
- data/lib/generators/echo_base/templates/features/manage_users.feature +0 -45
- data/lib/generators/echo_base/templates/features/step_definitions/authentication_steps.rb +0 -14
- data/lib/generators/echo_base/templates/features/step_definitions/users_steps.rb +0 -14
- data/lib/generators/echo_base/templates/features/step_definitions/web_steps.rb +0 -219
- data/lib/generators/echo_base/templates/features/support/env.rb +0 -57
- data/lib/generators/echo_base/templates/features/support/paths.rb +0 -39
- data/lib/generators/echo_base/templates/spec/controllers/sessions_controller_spec.rb +0 -5
- data/lib/generators/echo_base/templates/spec/controllers/users_controller_spec.rb +0 -125
- data/lib/generators/echo_base/templates/spec/helpers/users_helper_spec.rb +0 -15
- data/lib/generators/echo_base/templates/spec/models/authorization_spec.rb +0 -5
- data/lib/generators/echo_base/templates/spec/models/user_spec.rb +0 -5
- data/lib/generators/echo_base/templates/spec/routing/users_routing_spec.rb +0 -35
- data/lib/generators/echo_base/templates/spec/spec_helper.rb +0 -16
- data/lib/generators/echo_base/templates/spec/views/users/edit.html.erb_spec.rb +0 -27
- data/lib/generators/echo_base/templates/spec/views/users/index.html.erb_spec.rb +0 -36
- data/lib/generators/echo_base/templates/spec/views/users/new.html.erb_spec.rb +0 -27
- data/lib/generators/echo_base/templates/spec/views/users/show.html.erb_spec.rb +0 -27
- data/test/helper.rb +0 -10
- data/test/test_echo_base.rb +0 -7
@@ -1,57 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
ENV["RAILS_ENV"] ||= "test"
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
9
|
-
|
10
|
-
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
11
|
-
require 'cucumber/rails/world'
|
12
|
-
require 'cucumber/rails/active_record'
|
13
|
-
require 'cucumber/web/tableish'
|
14
|
-
|
15
|
-
require 'capybara/rails'
|
16
|
-
require 'capybara/cucumber'
|
17
|
-
require 'capybara/session'
|
18
|
-
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
|
19
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
20
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
21
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
22
|
-
# steps to use the XPath syntax.
|
23
|
-
Capybara.default_selector = :css
|
24
|
-
|
25
|
-
# If you set this to false, any error raised from within your app will bubble
|
26
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
27
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
28
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
29
|
-
#
|
30
|
-
# If you set this to true, Rails will rescue all errors and render error
|
31
|
-
# pages, more or less in the same way your application would behave in the
|
32
|
-
# default production environment. It's not recommended to do this for all
|
33
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
34
|
-
ActionController::Base.allow_rescue = false
|
35
|
-
|
36
|
-
# If you set this to true, each scenario will run in a database transaction.
|
37
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
38
|
-
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
39
|
-
# tagging with @culerity or @javascript will also turn transactions off.
|
40
|
-
#
|
41
|
-
# If you set this to false, transactions will be off for all scenarios,
|
42
|
-
# regardless of whether you use @no-txn or not.
|
43
|
-
#
|
44
|
-
# Beware that turning transactions off will leave data in your database
|
45
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
46
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
47
|
-
# block that will explicitly put your database in a known state.
|
48
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
49
|
-
# How to clean your database when transactions are turned off. See
|
50
|
-
# http://github.com/bmabey/database_cleaner for more info.
|
51
|
-
if defined?(ActiveRecord::Base)
|
52
|
-
begin
|
53
|
-
require 'database_cleaner'
|
54
|
-
DatabaseCleaner.strategy = :truncation
|
55
|
-
rescue LoadError => ignore_if_database_cleaner_not_present
|
56
|
-
end
|
57
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
# Maps a name to a path. Used by the
|
3
|
-
#
|
4
|
-
# When /^I go to (.+)$/ do |page_name|
|
5
|
-
#
|
6
|
-
# step definition in web_steps.rb
|
7
|
-
#
|
8
|
-
def path_to(page_name)
|
9
|
-
case page_name
|
10
|
-
|
11
|
-
when /the home\s?page/
|
12
|
-
'/'
|
13
|
-
when /the new authentication page/
|
14
|
-
new_authentication_path
|
15
|
-
|
16
|
-
when /the new users page/
|
17
|
-
new_users_path
|
18
|
-
|
19
|
-
|
20
|
-
# Add more mappings here.
|
21
|
-
# Here is an example that pulls values out of the Regexp:
|
22
|
-
#
|
23
|
-
# when /^(.*)'s profile page$/i
|
24
|
-
# user_profile_path(User.find_by_login($1))
|
25
|
-
|
26
|
-
else
|
27
|
-
begin
|
28
|
-
page_name =~ /the (.*) page/
|
29
|
-
path_components = $1.split(/\s+/)
|
30
|
-
self.send(path_components.push('path').join('_').to_sym)
|
31
|
-
rescue Object => e
|
32
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
33
|
-
"Now, go and add a mapping in #{__FILE__}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
World(NavigationHelpers)
|
@@ -1,125 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe UsersController do
|
4
|
-
|
5
|
-
def mock_user(stubs={})
|
6
|
-
@mock_user ||= mock_model(User, stubs).as_null_object
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "GET index" do
|
10
|
-
it "assigns all users as @users" do
|
11
|
-
User.stub(:all) { [mock_user] }
|
12
|
-
get :index
|
13
|
-
assigns(:users).should eq([mock_user])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "GET show" do
|
18
|
-
it "assigns the requested user as @user" do
|
19
|
-
User.stub(:find).with("37") { mock_user }
|
20
|
-
get :show, :id => "37"
|
21
|
-
assigns(:user).should be(mock_user)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "GET new" do
|
26
|
-
it "assigns a new user as @user" do
|
27
|
-
User.stub(:new) { mock_user }
|
28
|
-
get :new
|
29
|
-
assigns(:user).should be(mock_user)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "GET edit" do
|
34
|
-
it "assigns the requested user as @user" do
|
35
|
-
User.stub(:find).with("37") { mock_user }
|
36
|
-
get :edit, :id => "37"
|
37
|
-
assigns(:user).should be(mock_user)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "POST create" do
|
42
|
-
|
43
|
-
describe "with valid params" do
|
44
|
-
it "assigns a newly created user as @user" do
|
45
|
-
User.stub(:new).with({'these' => 'params'}) { mock_user(:save => true) }
|
46
|
-
post :create, :user => {'these' => 'params'}
|
47
|
-
assigns(:user).should be(mock_user)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "redirects to the created user" do
|
51
|
-
User.stub(:new) { mock_user(:save => true) }
|
52
|
-
post :create, :user => {}
|
53
|
-
response.should redirect_to(user_url(mock_user))
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "with invalid params" do
|
58
|
-
it "assigns a newly created but unsaved user as @user" do
|
59
|
-
User.stub(:new).with({'these' => 'params'}) { mock_user(:save => false) }
|
60
|
-
post :create, :user => {'these' => 'params'}
|
61
|
-
assigns(:user).should be(mock_user)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "re-renders the 'new' template" do
|
65
|
-
User.stub(:new) { mock_user(:save => false) }
|
66
|
-
post :create, :user => {}
|
67
|
-
response.should render_template("new")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "PUT update" do
|
74
|
-
|
75
|
-
describe "with valid params" do
|
76
|
-
it "updates the requested user" do
|
77
|
-
User.should_receive(:find).with("37") { mock_user }
|
78
|
-
mock_user.should_receive(:update_attributes).with({'these' => 'params'})
|
79
|
-
put :update, :id => "37", :user => {'these' => 'params'}
|
80
|
-
end
|
81
|
-
|
82
|
-
it "assigns the requested user as @user" do
|
83
|
-
User.stub(:find) { mock_user(:update_attributes => true) }
|
84
|
-
put :update, :id => "1"
|
85
|
-
assigns(:user).should be(mock_user)
|
86
|
-
end
|
87
|
-
|
88
|
-
it "redirects to the user" do
|
89
|
-
User.stub(:find) { mock_user(:update_attributes => true) }
|
90
|
-
put :update, :id => "1"
|
91
|
-
response.should redirect_to(user_url(mock_user))
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "with invalid params" do
|
96
|
-
it "assigns the user as @user" do
|
97
|
-
User.stub(:find) { mock_user(:update_attributes => false) }
|
98
|
-
put :update, :id => "1"
|
99
|
-
assigns(:user).should be(mock_user)
|
100
|
-
end
|
101
|
-
|
102
|
-
it "re-renders the 'edit' template" do
|
103
|
-
User.stub(:find) { mock_user(:update_attributes => false) }
|
104
|
-
put :update, :id => "1"
|
105
|
-
response.should render_template("edit")
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
describe "DELETE destroy" do
|
112
|
-
it "destroys the requested user" do
|
113
|
-
User.should_receive(:find).with("37") { mock_user }
|
114
|
-
mock_user.should_receive(:destroy)
|
115
|
-
delete :destroy, :id => "37"
|
116
|
-
end
|
117
|
-
|
118
|
-
it "redirects to the users list" do
|
119
|
-
User.stub(:find) { mock_user }
|
120
|
-
delete :destroy, :id => "1"
|
121
|
-
response.should redirect_to(users_url)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Specs in this file have access to a helper object that includes
|
4
|
-
# the UsersHelper. For example:
|
5
|
-
#
|
6
|
-
# describe UsersHelper do
|
7
|
-
# describe "string concat" do
|
8
|
-
# it "concats two strings with spaces" do
|
9
|
-
# helper.concat_strings("this","that").should == "this that"
|
10
|
-
# end
|
11
|
-
# end
|
12
|
-
# end
|
13
|
-
describe UsersHelper do
|
14
|
-
pending "add some examples to (or delete) #{__FILE__}"
|
15
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe UsersController do
|
4
|
-
describe "routing" do
|
5
|
-
|
6
|
-
it "recognizes and generates #index" do
|
7
|
-
{ :get => "/users" }.should route_to(:controller => "users", :action => "index")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "recognizes and generates #new" do
|
11
|
-
{ :get => "/users/new" }.should route_to(:controller => "users", :action => "new")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "recognizes and generates #show" do
|
15
|
-
{ :get => "/users/1" }.should route_to(:controller => "users", :action => "show", :id => "1")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "recognizes and generates #edit" do
|
19
|
-
{ :get => "/users/1/edit" }.should route_to(:controller => "users", :action => "edit", :id => "1")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "recognizes and generates #create" do
|
23
|
-
{ :post => "/users" }.should route_to(:controller => "users", :action => "create")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "recognizes and generates #update" do
|
27
|
-
{ :put => "/users/1" }.should route_to(:controller => "users", :action => "update", :id => "1")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "recognizes and generates #destroy" do
|
31
|
-
{ :delete => "/users/1" }.should route_to(:controller => "users", :action => "destroy", :id => "1")
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
require 'webmock/rspec'
|
6
|
-
|
7
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
-
# in spec/support/ and its subdirectories.
|
9
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.mock_with :rspec
|
13
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
14
|
-
config.use_transactional_fixtures = true
|
15
|
-
config.include WebMock
|
16
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "users/edit.html.erb" do
|
4
|
-
before(:each) do
|
5
|
-
@user = assign(:user, stub_model(User,
|
6
|
-
:new_record? => false,
|
7
|
-
:name => "MyString",
|
8
|
-
:nickname => "MyString",
|
9
|
-
:image => "MyString",
|
10
|
-
:description => "MyString",
|
11
|
-
:location => "MyString"
|
12
|
-
))
|
13
|
-
end
|
14
|
-
|
15
|
-
it "renders the edit user form" do
|
16
|
-
render
|
17
|
-
|
18
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
19
|
-
assert_select "form", :action => user_path(@user), :method => "post" do
|
20
|
-
assert_select "input#user_name", :name => "user[name]"
|
21
|
-
assert_select "input#user_nickname", :name => "user[nickname]"
|
22
|
-
assert_select "input#user_image", :name => "user[image]"
|
23
|
-
assert_select "input#user_description", :name => "user[description]"
|
24
|
-
assert_select "input#user_location", :name => "user[location]"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "users/index.html.erb" do
|
4
|
-
before(:each) do
|
5
|
-
assign(:users, [
|
6
|
-
stub_model(User,
|
7
|
-
:name => "Name",
|
8
|
-
:nickname => "Nickname",
|
9
|
-
:image => "Image",
|
10
|
-
:description => "Description",
|
11
|
-
:location => "Location"
|
12
|
-
),
|
13
|
-
stub_model(User,
|
14
|
-
:name => "Name",
|
15
|
-
:nickname => "Nickname",
|
16
|
-
:image => "Image",
|
17
|
-
:description => "Description",
|
18
|
-
:location => "Location"
|
19
|
-
)
|
20
|
-
])
|
21
|
-
end
|
22
|
-
|
23
|
-
it "renders a list of users" do
|
24
|
-
render
|
25
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
26
|
-
assert_select "tr>td", :text => "Name".to_s, :count => 2
|
27
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
28
|
-
assert_select "tr>td", :text => "Nickname".to_s, :count => 2
|
29
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
30
|
-
assert_select "tr>td", :text => "Image".to_s, :count => 2
|
31
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
32
|
-
assert_select "tr>td", :text => "Description".to_s, :count => 2
|
33
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
34
|
-
assert_select "tr>td", :text => "Location".to_s, :count => 2
|
35
|
-
end
|
36
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "users/new.html.erb" do
|
4
|
-
before(:each) do
|
5
|
-
assign(:user, stub_model(User,
|
6
|
-
:new_record? => true,
|
7
|
-
:name => "MyString",
|
8
|
-
:nickname => "MyString",
|
9
|
-
:image => "MyString",
|
10
|
-
:description => "MyString",
|
11
|
-
:location => "MyString"
|
12
|
-
))
|
13
|
-
end
|
14
|
-
|
15
|
-
it "renders new user form" do
|
16
|
-
render
|
17
|
-
|
18
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
19
|
-
assert_select "form", :action => users_path, :method => "post" do
|
20
|
-
assert_select "input#user_name", :name => "user[name]"
|
21
|
-
assert_select "input#user_nickname", :name => "user[nickname]"
|
22
|
-
assert_select "input#user_image", :name => "user[image]"
|
23
|
-
assert_select "input#user_description", :name => "user[description]"
|
24
|
-
assert_select "input#user_location", :name => "user[location]"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "users/show.html.erb" do
|
4
|
-
before(:each) do
|
5
|
-
@user = assign(:user, stub_model(User,
|
6
|
-
:name => "Name",
|
7
|
-
:nickname => "Nickname",
|
8
|
-
:image => "Image",
|
9
|
-
:description => "Description",
|
10
|
-
:location => "Location"
|
11
|
-
))
|
12
|
-
end
|
13
|
-
|
14
|
-
it "renders attributes in <p>" do
|
15
|
-
render
|
16
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
17
|
-
rendered.should match(/Name/)
|
18
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
19
|
-
rendered.should match(/Nickname/)
|
20
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
21
|
-
rendered.should match(/Image/)
|
22
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
23
|
-
rendered.should match(/Description/)
|
24
|
-
# Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
|
25
|
-
rendered.should match(/Location/)
|
26
|
-
end
|
27
|
-
end
|
data/test/helper.rb
DELETED