This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Surveys::ReportController < ApplicationController | |
def show | |
Survey.find() | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../spec_helper' | |
class Foo | |
def self.per_page | |
10 | |
end | |
end | |
describe Foo do | |
should_have_per_page 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
validate :only_superusers_can_do_foo | |
private | |
def superuser? | |
if account == "Super User" | |
true | |
else | |
false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
has_many :roles | |
# can answer... has_role?, as(...), etc | |
include Roles::RoleMethods | |
end | |
class ApplicationController | |
rescue_from Roles::RoleNotFound, AccessDenied do | |
# send to 401.html, send back some error text/json, whatever... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcc -O2 -g -Wall -Wno-parentheses -pipe -fno-common -I. -I.ext/include/i386-darwin9.5.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o parse.o -c parse.c | |
In file included from parse.y:6022: | |
lex.c:1: error: syntax error before ‘<<’ token | |
keywords:2: error: syntax error before ‘}’ token | |
keywords: In function ‘rb_reserved_word’: | |
keywords:83: error: array type has incomplete element type | |
keywords:83: warning: unused variable ‘wordlist’ | |
parse.y: In function ‘parser_yylex’: | |
parse.y:7547: error: dereferencing pointer to incomplete type | |
parse.y:7549: error: dereferencing pointer to incomplete type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Expense < ActiveRecord::Base | |
composed_of :amount, :class_name => "Money", :mapping => [ %w(amount_in_cents cents)], :converter => lambda { |amount| amount.to_money } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Story: Users without fiscal admin role accessing Invoices | |
In order to ensure users that shouldn't have access to fiscal components don't | |
As a user who isn't a fiscal admin | |
I should not be able to access Invoices | |
Scenario: Users without the fiscal admin role cannot access certain resources | |
Given I've log in as a user without the 'fiscal admin' role | |
When I try to GET /invoices | |
Then I am notified that I do not have access to that | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When I run the specs above, the following error occurs: | |
$ script/spec -c spec/controllers/strange_name_error.rb | |
./spec/controllers/strange_name_error.rb:15: undefined local variable or method `properties_url' for #<Class:0x22b918c> (NameError) | |
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:68:in `module_eval' | |
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:68:in `create_nested_example_group' | |
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `instance_eval' | |
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `subclass' | |
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:66:in `create_nested_example_group' | |
from /Users/nick/src/housing-rentals/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:53:in `describe' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rescue_action_with_fast_errors(exception) | |
unless rescue_with_handler(exception) | |
if use_rails_error_handling? | |
rescue_action_without_handler(exception) | |
else | |
raise exception | |
end | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rescue_action_with_fast_errors(exception) | |
unless rescue_with_handler(exception) | |
if use_rails_error_handling? | |
rescue_action_without_handler(exception) | |
else | |
raise exception | |
end | |
end | |
end | |
OlderNewer