View old_style_controller_spec.rb
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 'spec_helper' | |
describe GroupsController do | |
include SessionTestHelper | |
describe "GET 'show'" do | |
it "should load the group from the database" do | |
@the_group = Factory(:group) | |
Group.stub(:find_active_by_unique_name).with("london-developers"). | |
and_return(@the_group) |
View story
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
Scenario: An admin viewing the bums only list of beta users | |
Given no Users and no BetaUsers | |
And a User with no login, email 'admin@site.com', and password 'I like cats' | |
And a BetaUser 'jimbo1@fat.com' | |
And a BetaUser 'jimbo2@fat.com' who is no bum | |
And 'admin@site.com' logged in with password 'I like cats' (FAILED) # response.body is empty! | |
When that user requests '/admin/beta_users' with bums_only true | |
View list_steps.rb
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
steps_for(:viewing) do | |
When("$agent requests '/list_views.xml'") do |agent| | |
get '/list_views.xml' | |
# This is displaying correctly for both scenarios | |
puts "<pre>#{response.body}</pre>" | |
end | |
Then("they should see a list of lists containing '$list_name'") do |list_name| | |
response.should have_tag('list-views>list-view>name', list_name) |
View !!! debug statements
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
WHERE THE HELL IS E2's remember me coming from!??!?!? (last line) | |
E 1: {"test_ls"=>"TUEukYXutyX4CnrjckGjYw%3D%3D--2aa4c5c7df094842a0ee60107f1ff444496e78a1", "test_session"=>"BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl%0Ac3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp%0AAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f%0AdG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI%0AYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"} | |
A 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_session"=>["BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl\nc3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp\nAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f\ndG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI\nYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"]} | |
B 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_sess |
View debug statements
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
E 1: {"test_ls"=>"TUEukYXutyX4CnrjckGjYw%3D%3D--2aa4c5c7df094842a0ee60107f1ff444496e78a1", "test_session"=>"BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl%0Ac3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp%0AAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f%0AdG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI%0AYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"} | |
A 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_session"=>["BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl\nc3Npb25faWRpAnE8OhFsX3Nlc3Npb25faWRpAoE7Og1xdWVzdGlvbnsHOwlp\nAtQtOgxhbnN3ZXJzWwhpAnqJaQJ7iWkCfIk6CXVzZXJpAgcQOg5yZXR1cm5f\ndG8wIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hI\nYXNoewAGOgpAdXNlZHsA--5ea2ecb92e6706a4335241a853a86889a0203489"]} | |
B 1: {"test_ls"=>["TUEukYXutyX4CnrjckGjYw==--2aa4c5c7df094842a0ee60107f1ff444496e78a1"], "test_session"=>["BAh7CjoOeF9zZXNzaW9uewg6GGFub255bW91c19yX3Nlc3Npb25GOhFyX3Nl\ |
View assoc delete behavior
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
has_many | ... | :dependent => :destroy | :dependent => :delete_all | |
--------------------------------------------------------------------------------------------------- | |
@post.clear | doesn't delete in db | destroy on each record | 1 DELETE (no callbacks, etc.) | |
@post.destroy_all | doesn't delete in db | destroy on each record | destroy on each record | |
@post.delete_all | doesn't delete in db | destroy on each record | 1 DELETE (no callbacks, etc.) |
View scopify.rb
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 scopify(model_class, *scopes) | |
mocks = [model_class] | |
scopes.each do |scope| | |
mocks << mock(scope.to_s) | |
end | |
mocks.each do |mock| | |
mocks.delete_if { |m| m == mock || m == model_class }.each do |m| | |
mock.stub!(m.instance_variable_get(:@name)).and_return(model_class) | |
end | |
end |
View gist:13416
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 'singleton' | |
begin | |
require 'daemon_controller' | |
rescue LoadError | |
raise('FATAL: sudo gem install FooBarWidget-daemon_controller -s http://gems.github.com') | |
end | |
## | |
# sudo port install memcached | |
class DaemonMemcache |
View session_model_proxy.rb
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 SessionModelProxy | |
attr_reader :session_data | |
def initialize(user, session_data, *args) | |
if session_data.is_a?(Hash) | |
@session_data = session_data | |
else | |
load_from_db(klass.find(id), args) | |
end |
View grammar
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
{ scopeName = 'source.ruby.cucumber.steps'; | |
fileTypes = ( 'steps.rb' ); | |
patterns = ( | |
{ name = 'keyword'; | |
match = '\b(GivenScenario|Given|When|Then)\b'; | |
}, | |
{ name = 'string.regexp.classic.ruby'; | |
begin = '(?:GivenScenario\s)|(?:Given\s)|(?:When\s)|(?:Then\s)\s*((/))(?![*+{}?])'; | |
end = '((/[eimnosux]*))'; | |
}, |
OlderNewer