repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/controller.rb | lib/generators/nifty/scaffold/templates/tests/testunit/controller.rb | require 'test_helper'
class <%= plural_class_name %>ControllerTest < ActionController::TestCase
<%= controller_methods 'tests/testunit/actions' %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/model.rb | lib/generators/nifty/scaffold/templates/tests/testunit/model.rb | require 'test_helper'
class <%= class_name %>Test < ActiveSupport::TestCase
def test_should_be_valid
assert <%= class_name %>.new.valid?
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb | def test_update_invalid
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
put :update, :id => <%= class_name %>.first
assert_template 'edit'
end
def test_update_valid
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
put :update, :id => <%= class_name %>.first
assert_... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/index.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/index.rb | def test_index
get :index
assert_template 'index'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/new.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/new.rb | def test_new
get :new
assert_template 'new'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb | def test_create_invalid
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
def test_create_valid
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
post :create
assert_redirected_to <%= item_path_for_test('url') %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/destroy.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/destroy.rb | def test_destroy
<%= instance_name %> = <%= class_name %>.first
delete :destroy, :id => <%= instance_name %>
assert_redirected_to <%= items_url %>
assert !<%= class_name %>.exists?(<%= instance_name %>.id)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/show.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/show.rb | def test_show
get :show, :id => <%= class_name %>.first
assert_template 'show'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/testunit/actions/edit.rb | lib/generators/nifty/scaffold/templates/tests/testunit/actions/edit.rb | def test_edit
get :edit, :id => <%= class_name %>.first
assert_template 'edit'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb | lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= plural_class_name %>Controller do
fixtures :all
render_views
<%= controller_methods 'tests/rspec/actions' %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/model.rb | lib/generators/nifty/scaffold/templates/tests/rspec/model.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= class_name %> do
it "should be valid" do
<%= class_name %>.new.should be_valid
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb | it "update action should render edit template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
put :update, :id => <%= class_name %>.first
response.should render_template(:edit)
end
it "update action should redirect when model is valid" do
<%= class_name %>.a... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/index.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/index.rb | it "index action should render index template" do
get :index
response.should render_template(:index)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/new.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/new.rb | it "new action should render new template" do
get :new
response.should render_template(:new)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb | it "create action should render new template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
response.should render_template(:new)
end
it "create action should redirect when model is valid" do
<%= class_name %>.any_instance.stubs(:valid?).return... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/destroy.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/destroy.rb | it "destroy action should destroy model and redirect to index action" do
<%= instance_name %> = <%= class_name %>.first
delete :destroy, :id => <%= instance_name %>
response.should redirect_to(<%= items_url %>)
<%= class_name %>.exists?(<%= instance_name %>.id).should be_false
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/show.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/show.rb | it "show action should render show template" do
get :show, :id => <%= class_name %>.first
response.should render_template(:show)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/rspec/actions/edit.rb | lib/generators/nifty/scaffold/templates/tests/rspec/actions/edit.rb | it "edit action should render edit template" do
get :edit, :id => <%= class_name %>.first
response.should render_template(:edit)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/controller.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/controller.rb | require 'test_helper'
class <%= plural_class_name %>ControllerTest < ActionController::TestCase
<%= controller_methods 'tests/shoulda/actions' %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/model.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/model.rb | require 'test_helper'
class <%= class_name %>Test < ActiveSupport::TestCase
should "be valid" do
assert <%= class_name %>.new.valid?
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb | context "update action" do
should "render edit template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
put :update, :id => <%= class_name %>.first
assert_template 'edit'
end
should "redirect when model is valid" do
<%= class_name %>.any_inst... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/index.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/index.rb | context "index action" do
should "render index template" do
get :index
assert_template 'index'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/new.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/new.rb | context "new action" do
should "render new template" do
get :new
assert_template 'new'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb | context "create action" do
should "render new template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
should "redirect when model is valid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(true)... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/destroy.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/destroy.rb | context "destroy action" do
should "destroy model and redirect to index action" do
<%= instance_name %> = <%= class_name %>.first
delete :destroy, :id => <%= instance_name %>
assert_redirected_to <%= items_url %>
assert !<%= class_name %>.exists?(<%= instance_name %>.id)
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/show.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/show.rb | context "show action" do
should "render show template" do
get :show, :id => <%= class_name %>.first
assert_template 'show'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/edit.rb | lib/generators/nifty/scaffold/templates/tests/shoulda/actions/edit.rb | context "edit action" do
should "render edit template" do
get :edit, :id => <%= class_name %>.first
assert_template 'edit'
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/update.rb | lib/generators/nifty/scaffold/templates/actions/update.rb | def update
@<%= instance_name %> = <%= class_name %>.find(params[:id])
if @<%= instance_name %>.update_attributes(params[:<%= instance_name %>])
redirect_to <%= item_url %>, :notice => "Successfully updated <%= class_name.underscore.humanize.downcase %>."
else
render :edit
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/index.rb | lib/generators/nifty/scaffold/templates/actions/index.rb | def index
@<%= instances_name %> = <%= class_name %>.all
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/new.rb | lib/generators/nifty/scaffold/templates/actions/new.rb | def new
@<%= instance_name %> = <%= class_name %>.new
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/create.rb | lib/generators/nifty/scaffold/templates/actions/create.rb | def create
@<%= instance_name %> = <%= class_name %>.new(params[:<%= instance_name %>])
if @<%= instance_name %>.save
redirect_to <%= item_url %>, :notice => "Successfully created <%= class_name.underscore.humanize.downcase %>."
else
render :new
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/destroy.rb | lib/generators/nifty/scaffold/templates/actions/destroy.rb | def destroy
@<%= instance_name %> = <%= class_name %>.find(params[:id])
@<%= instance_name %>.destroy
redirect_to <%= items_url %>, :notice => "Successfully destroyed <%= class_name.underscore.humanize.downcase %>."
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/show.rb | lib/generators/nifty/scaffold/templates/actions/show.rb | def show
@<%= instance_name %> = <%= class_name %>.find(params[:id])
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/actions/edit.rb | lib/generators/nifty/scaffold/templates/actions/edit.rb | def edit
@<%= instance_name %> = <%= class_name %>.find(params[:id])
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/authentication_generator.rb | lib/generators/nifty/authentication/authentication_generator.rb | require 'generators/nifty'
require 'rails/generators/migration'
module Nifty
module Generators
class AuthenticationGenerator < Base
include Rails::Generators::Migration
argument :user_name, :type => :string, :default => 'user', :banner => 'user_name'
argument :session_name, :type => :string, :... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/sessions_helper.rb | lib/generators/nifty/authentication/templates/sessions_helper.rb | module <%= session_plural_class_name %>Helper
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/users_helper.rb | lib/generators/nifty/authentication/templates/users_helper.rb | module <%= user_plural_class_name %>Helper
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/users_controller.rb | lib/generators/nifty/authentication/templates/users_controller.rb | class <%= user_plural_class_name %>Controller < ApplicationController
before_filter :login_required, :except => [:new, :create]
def new
@<%= user_singular_name %> = <%= user_class_name %>.new
end
def create
@<%= user_singular_name %> = <%= user_class_name %>.new(params[:<%= user_singular_name %>])
... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/controller_authentication.rb | lib/generators/nifty/authentication/templates/controller_authentication.rb | # This module is included in your application controller which makes
# several methods available to all controllers and views. Here's a
# common example you might add to your application layout file.
#
# <%% if logged_in? %>
# Welcome <%%= current_<%= user_singular_name %>.username %>.
# <%%= link_to "Edit pr... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/authlogic_session.rb | lib/generators/nifty/authentication/templates/authlogic_session.rb | class <%= session_class_name %> < Authlogic::Session::Base
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/migration.rb | lib/generators/nifty/authentication/templates/migration.rb | class Create<%= user_plural_class_name %> < ActiveRecord::Migration
def self.up
create_table :<%= user_plural_name %> do |t|
t.string :username
t.string :email
<%- if options[:authlogic] -%>
t.string :persistence_token
t.string :crypted_password
<%- else -%>
t.string :passwor... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/sessions_controller.rb | lib/generators/nifty/authentication/templates/sessions_controller.rb | class <%= session_plural_class_name %>Controller < ApplicationController
<%- if options[:authlogic] -%>
def new
@<%= session_singular_name %> = <%= session_class_name %>.new
end
def create
@<%= session_singular_name %> = <%= session_class_name %>.new(params[:<%= session_singular_name %>])
if @<%= ses... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/user.rb | lib/generators/nifty/authentication/templates/user.rb | class <%= user_class_name %> < ActiveRecord::Base
<%- if options[:authlogic] -%>
acts_as_authentic
<%- else -%>
# new columns need to be added here to be writable through mass assignment
attr_accessible :username, :email, :password, :password_confirmation
attr_accessor :password
before_save :prepare_password... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/testunit/users_controller.rb | lib/generators/nifty/authentication/templates/tests/testunit/users_controller.rb | require 'test_helper'
class <%= user_plural_class_name %>ControllerTest < ActionController::TestCase
def test_new
get :new
assert_template 'new'
end
def test_create_invalid
<%= user_class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
def test_... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/testunit/sessions_controller.rb | lib/generators/nifty/authentication/templates/tests/testunit/sessions_controller.rb | require 'test_helper'
class <%= session_plural_class_name %>ControllerTest < ActionController::TestCase
def test_new
get :new
assert_template 'new'
end
<%- if options[:authlogic] -%>
def test_create_invalid
post :create, :<%= session_singular_name %> => { :username => "foo", :password => "badpasswor... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/testunit/user.rb | lib/generators/nifty/authentication/templates/tests/testunit/user.rb | require 'test_helper'
class <%= user_class_name %>Test < ActiveSupport::TestCase
<%- unless options[:authlogic] -%>
def new_<%= user_singular_name %>(attributes = {})
attributes[:username] ||= 'foo'
attributes[:email] ||= 'foo@example.com'
attributes[:password] ||= 'abc123'
attributes[:password_confi... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/rspec/users_controller.rb | lib/generators/nifty/authentication/templates/tests/rspec/users_controller.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= user_plural_class_name %>Controller do
fixtures :all
render_views
it "new action should render new template" do
get :new
response.should render_template(:new)
end
it "create action should render new template when model is invalid" do
... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/rspec/sessions_controller.rb | lib/generators/nifty/authentication/templates/tests/rspec/sessions_controller.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= session_plural_class_name %>Controller do
fixtures :all
render_views
it "new action should render new template" do
get :new
response.should render_template(:new)
end
<%- if options[:authlogic] -%>
it "create action should render new te... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/rspec/user.rb | lib/generators/nifty/authentication/templates/tests/rspec/user.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= user_class_name %> do
<%- unless options[:authlogic] -%>
def new_<%= user_singular_name %>(attributes = {})
attributes[:username] ||= 'foo'
attributes[:email] ||= 'foo@example.com'
attributes[:password] ||= 'abc123'
attributes[:password_... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb | lib/generators/nifty/authentication/templates/tests/shoulda/users_controller.rb | require 'test_helper'
class <%= user_plural_class_name %>ControllerTest < ActionController::TestCase
context "new action" do
should "render new template" do
get :new
assert_template 'new'
end
end
context "create action" do
should "render new template when <%= user_singular_name %> is inv... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/shoulda/sessions_controller.rb | lib/generators/nifty/authentication/templates/tests/shoulda/sessions_controller.rb | require 'test_helper'
class <%= session_plural_class_name %>ControllerTest < ActionController::TestCase
context "new action" do
should "render new template" do
get :new
assert_template 'new'
end
end
context "create action" do
<%- if options[:authlogic] -%>
should "render new template w... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/authentication/templates/tests/shoulda/user.rb | lib/generators/nifty/authentication/templates/tests/shoulda/user.rb | require 'test_helper'
class <%= user_class_name %>Test < ActiveSupport::TestCase
<%- unless options[:authlogic] -%>
def new_<%= user_singular_name %>(attributes = {})
attributes[:username] ||= 'foo'
attributes[:email] ||= 'foo@example.com'
attributes[:password] ||= 'abc123'
attributes[:password_confi... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/layout/layout_generator.rb | lib/generators/nifty/layout/layout_generator.rb | require 'generators/nifty'
module Nifty
module Generators
class LayoutGenerator < Base
argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'
class_option :haml, :desc => 'Generate HAML for view, and SASS for stylesheet.', :type => :boolean
def create_lay... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/layout/templates/layout_helper.rb | lib/generators/nifty/layout/templates/layout_helper.rb | # These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
content_for... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/layout/templates/error_messages_helper.rb | lib/generators/nifty/layout/templates/error_messages_helper.rb | module ErrorMessagesHelper
# Render error messages for the given objects. The :message and :header_message options are allowed.
def error_messages_for(*objects)
options = objects.extract_options!
options[:header_message] ||= I18n.t(:"activerecord.errors.header", :default => "Invalid Fields")
options[:me... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/config/config_generator.rb | lib/generators/nifty/config/config_generator.rb | require 'generators/nifty'
module Nifty
module Generators
class ConfigGenerator < Base
argument :config_name, :type => :string, :default => 'app', :banner => 'config_name'
def create_config
template "load_config.rb", "config/initializers/load_#{file_name}_config.rb"
copy_file "config... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/config/templates/load_config.rb | lib/generators/nifty/config/templates/load_config.rb | raw_config = File.read("#{Rails.root}/config/<%= file_name %>_config.yml")
<%= constant_name %>_CONFIG = YAML.load(raw_config)[Rails.env].symbolize_keys
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_layout/nifty_layout_generator.rb | rails_generators/nifty_layout/nifty_layout_generator.rb | class NiftyLayoutGenerator < Rails::Generator::Base
def initialize(runtime_args, runtime_options = {})
super
@name = @args.first || 'application'
end
def manifest
record do |m|
m.directory 'app/views/layouts'
m.directory 'public/stylesheets'
m.directory 'app/helpers'
if optio... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_layout/templates/helper.rb | rails_generators/nifty_layout/templates/helper.rb | # These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
@show_title... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/nifty_authentication_generator.rb | rails_generators/nifty_authentication/nifty_authentication_generator.rb | require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
class NiftyAuthenticationGenerator < Rails::Generator::Base
attr_accessor :user_name, :session_name
def initialize(runtime_args, runtime_options = {})
super
@user_name = @args[0] || 'user'
@session_name = @args[1] || (options... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/authentication.rb | rails_generators/nifty_authentication/templates/authentication.rb | # This module is included in your application controller which makes
# several methods available to all controllers and views. Here's a
# common example you might add to your application layout file.
#
# <%% if logged_in? %>
# Welcome <%%=h current_<%= user_singular_name %>.username %>! Not you?
# <%%= link_t... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/sessions_helper.rb | rails_generators/nifty_authentication/templates/sessions_helper.rb | module <%= session_plural_class_name %>Helper
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/users_helper.rb | rails_generators/nifty_authentication/templates/users_helper.rb | module <%= user_plural_class_name %>Helper
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/users_controller.rb | rails_generators/nifty_authentication/templates/users_controller.rb | class <%= user_plural_class_name %>Controller < ApplicationController
def new
@<%= user_singular_name %> = <%= user_class_name %>.new
end
def create
@<%= user_singular_name %> = <%= user_class_name %>.new(params[:<%= user_singular_name %>])
if @<%= user_singular_name %>.save
<%- unless options[:a... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/authlogic_session.rb | rails_generators/nifty_authentication/templates/authlogic_session.rb | class <%= session_class_name %> < Authlogic::Session::Base
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/migration.rb | rails_generators/nifty_authentication/templates/migration.rb | class Create<%= user_plural_class_name %> < ActiveRecord::Migration
def self.up
create_table :<%= user_plural_name %> do |t|
t.string :username
t.string :email
<%- if options[:authlogic] -%>
t.string :persistence_token
t.string :crypted_password
<%- else -%>
t.string :passwor... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/sessions_controller.rb | rails_generators/nifty_authentication/templates/sessions_controller.rb | class <%= session_plural_class_name %>Controller < ApplicationController
<%- if options[:authlogic] -%>
def new
@<%= session_singular_name %> = <%= session_class_name %>.new
end
def create
@<%= session_singular_name %> = <%= session_class_name %>.new(params[:<%= session_singular_name %>])
if @<%= ses... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/user.rb | rails_generators/nifty_authentication/templates/user.rb | class <%= user_class_name %> < ActiveRecord::Base
<%- if options[:authlogic] -%>
acts_as_authentic
<%- else -%>
# new columns need to be added here to be writable through mass assignment
attr_accessible :username, :email, :password, :password_confirmation
attr_accessor :password
before_save :prepare_password... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb | rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb | require 'test_helper'
class <%= user_plural_class_name %>ControllerTest < ActionController::TestCase
def test_new
get :new
assert_template 'new'
end
def test_create_invalid
<%= user_class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
def test_... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb | rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb | require 'test_helper'
class <%= session_plural_class_name %>ControllerTest < ActionController::TestCase
def test_new
get :new
assert_template 'new'
end
<%- if options[:authlogic] -%>
def test_create_invalid
post :create, :<%= session_singular_name %> => { :username => "foo", :password => "badpasswor... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/testunit/user.rb | rails_generators/nifty_authentication/templates/tests/testunit/user.rb | require 'test_helper'
class <%= user_class_name %>Test < ActiveSupport::TestCase
<%- unless options[:authlogic] -%>
def new_<%= user_singular_name %>(attributes = {})
attributes[:username] ||= 'foo'
attributes[:email] ||= 'foo@example.com'
attributes[:password] ||= 'abc123'
attributes[:password_confi... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb | rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= user_plural_class_name %>Controller do
fixtures :all
integrate_views
it "new action should render new template" do
get :new
response.should render_template(:new)
end
it "create action should render new template when model is invalid" d... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb | rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= session_plural_class_name %>Controller do
fixtures :all
integrate_views
it "new action should render new template" do
get :new
response.should render_template(:new)
end
<%- if options[:authlogic] -%>
it "create action should render new... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/rspec/user.rb | rails_generators/nifty_authentication/templates/tests/rspec/user.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= user_class_name %> do
<%- unless options[:authlogic] -%>
def new_<%= user_singular_name %>(attributes = {})
attributes[:username] ||= 'foo'
attributes[:email] ||= 'foo@example.com'
attributes[:password] ||= 'abc123'
attributes[:password_... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb | rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb | require 'test_helper'
class <%= user_plural_class_name %>ControllerTest < ActionController::TestCase
context "new action" do
should "render new template" do
get :new
assert_template 'new'
end
end
context "create action" do
should "render new template when model is invalid" do
<%= u... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb | rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb | require 'test_helper'
class <%= session_plural_class_name %>ControllerTest < ActionController::TestCase
context "new action" do
should "render new template" do
get :new
assert_template 'new'
end
end
context "create action" do
<%- if options[:authlogic] -%>
should "render new template w... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/templates/tests/shoulda/user.rb | rails_generators/nifty_authentication/templates/tests/shoulda/user.rb | require 'test_helper'
class <%= user_class_name %>Test < ActiveSupport::TestCase
<%- unless options[:authlogic] -%>
def new_<%= user_singular_name %>(attributes = {})
attributes[:username] ||= 'foo'
attributes[:email] ||= 'foo@example.com'
attributes[:password] ||= 'abc123'
attributes[:password_confi... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_authentication/lib/insert_commands.rb | rails_generators/nifty_authentication/lib/insert_commands.rb | Rails::Generator::Commands::Create.class_eval do
def route_resource(*resources)
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
sentinel = 'ActionController::Routing::Routes.draw do |map|'
logger.route "map.resource #{resource_list}"
unless options[:pretend]
gsub_file 'config/... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_config/nifty_config_generator.rb | rails_generators/nifty_config/nifty_config_generator.rb | class NiftyConfigGenerator < Rails::Generator::Base
def initialize(runtime_args, runtime_options = {})
super
@name = @args.first || 'app'
end
def manifest
record do |m|
m.directory 'config/initializers'
m.template "load_config.rb", "config/initializers/load_#{file_name}_config.rb"
... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_config/templates/load_config.rb | rails_generators/nifty_config/templates/load_config.rb | raw_config = File.read(RAILS_ROOT + "/config/<%= file_name %>_config.yml")
<%= constant_name %>_CONFIG = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb | rails_generators/nifty_scaffold/nifty_scaffold_generator.rb | class NiftyScaffoldGenerator < Rails::Generator::Base
attr_accessor :name, :attributes, :controller_actions
def initialize(runtime_args, runtime_options = {})
super
usage if @args.empty?
@name = @args.first
@controller_actions = []
@attributes = []
@args[1..-1].each do |arg|
if arg ... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/controller.rb | rails_generators/nifty_scaffold/templates/controller.rb | class <%= plural_class_name %>Controller < ApplicationController
<%= controller_methods :actions %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/helper.rb | rails_generators/nifty_scaffold/templates/helper.rb | module <%= plural_class_name %>Helper
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/migration.rb | rails_generators/nifty_scaffold/templates/migration.rb | class Create<%= plural_class_name %> < ActiveRecord::Migration
def self.up
create_table :<%= plural_name %> do |t|
<%- for attribute in attributes -%>
t.<%= attribute.type %> :<%= attribute.name %>
<%- end -%>
<%- unless options[:skip_timestamps] -%>
t.timestamps
<%- end -%>
end
... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/model.rb | rails_generators/nifty_scaffold/templates/model.rb | class <%= class_name %> < ActiveRecord::Base
attr_accessible <%= attributes.map { |a| ":#{a.name}" }.join(", ") %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb | rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb | require 'test_helper'
class <%= plural_class_name %>ControllerTest < ActionController::TestCase
<%= controller_methods 'tests/testunit/actions' %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/model.rb | rails_generators/nifty_scaffold/templates/tests/testunit/model.rb | require 'test_helper'
class <%= class_name %>Test < ActiveSupport::TestCase
def test_should_be_valid
assert <%= class_name %>.new.valid?
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb | def test_update_invalid
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
put :update, :id => <%= class_name %>.first
assert_template 'edit'
end
def test_update_valid
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
put :update, :id => <%= class_name %>.first
assert_... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb | def test_index
get :index
assert_template 'index'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb | def test_new
get :new
assert_template 'new'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb | def test_create_invalid
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
assert_template 'new'
end
def test_create_valid
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
post :create
assert_redirected_to <%= item_path_for_test('url') %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb | def test_destroy
<%= singular_name %> = <%= class_name %>.first
delete :destroy, :id => <%= singular_name %>
assert_redirected_to <%= items_path('url') %>
assert !<%= class_name %>.exists?(<%= singular_name %>.id)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb | def test_show
get :show, :id => <%= class_name %>.first
assert_template 'show'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb | rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb | def test_edit
get :edit, :id => <%= class_name %>.first
assert_template 'edit'
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb | rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= plural_class_name %>Controller do
fixtures :all
integrate_views
<%= controller_methods 'tests/rspec/actions' %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/model.rb | rails_generators/nifty_scaffold/templates/tests/rspec/model.rb | require File.dirname(__FILE__) + '/../spec_helper'
describe <%= class_name %> do
it "should be valid" do
<%= class_name %>.new.should be_valid
end
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb | it "update action should render edit template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
put :update, :id => <%= class_name %>.first
response.should render_template(:edit)
end
it "update action should redirect when model is valid" do
<%= class_name %>.a... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb | it "index action should render index template" do
get :index
response.should render_template(:index)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb | it "new action should render new template" do
get :new
response.should render_template(:new)
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb | rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb | it "create action should render new template when model is invalid" do
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
post :create
response.should render_template(:new)
end
it "create action should redirect when model is valid" do
<%= class_name %>.any_instance.stubs(:valid?).return... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.