Skip to content

Instantly share code, notes, and snippets.

View mhfs's full-sized avatar

Marcelo Silveira mhfs

View GitHub Profile
require File.dirname(__FILE__) + '/../spec_helper'
describe MailingsController, 'while secure controller' do
configure_controller
context 'and not logged in' do
before(:each) do
set_accounts
destroy_user_session
end
it "should not access actions" do
require File.dirname(__FILE__) + '/../spec_helper'
describe Mailing do
fixtures :mailings
it "should have some fixtures loaded" do
Mailing.should have(3).records
end
it { should belong_to :account }
require File.dirname(__FILE__) + '/../spec_helper'
describe AccountController do
as_any_user :get => :show do
it { should assign_to(:user, :with => @current_user)}
it { should respond_with(:success) }
end
as_any_user :get => :edit do
it { should assign_to(:user, :with => @current_user)}
def factories(*models)
models.each do |model|
(class << self; self; end).class_eval <<-METHOD
def factory_#{model}
@#{model} ||= Factory(:#{model})
end
METHOD
self.class_eval <<-METHOD
def factory_#{model}
def index
@assets = current_account.assets.paginate :page => params[:page], :per_page => 10
end
# How to spec this???
describe "As a visitor I want to be able to signup and login" do
it "should sign up with valid params" do
visit root_url
click_link "Sign Up"
fill_in "Name", :with => "Test User"
fill_in "Email", :with => "test@test.com"
fill_in "Password", :with => "123mudar"
fill_in "Password Confirmation", :with => "123mudar"
click_button "Save"
As a Provider
I want to be able sign up
So that I can can receive Rails project referrals
Scenario: Signing up with an invalid password confirmation
Given I am on the homepage
And I follow "provider.signup" translation
And I fill in the provider sign up form for "Pivotpaul Labs"
And I fill in the "First name" with "JD"
And I fill in the "Last name" with "Crow"
describe "As a visitor I want to be able to signup" do
def visit_and_fill_signup_form(valid = true)
visit root_url
click_link "Sign Up"
fill_in "Name", :with => "Test User"
fill_in "Email", :with => "test@test.com"
fill_in "Password", :with => "123mudar"
fill_in "Password Confirmation", :with => "123mudar" if valid
click_button "Save"
class Users::TaskListsController < InheritedResources::Base
defaults :route_prefix => ''
before_filter :authenticate_user!
belongs_to :user
protected
def begin_of_association_chain
@current_user
end
end
# This declaration ..
semantic_menu :class => "top_level_nav" do |root|
root.add "Home", root_path
root.add "Settings", settings_path do |settings|
settings.add "Users", users_path, :activate_for_deeper_paths => true
end
end
# .. would make the "Users" item active for all this URIs