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
# TO test that a model needs a name | |
user = User.build # Or however you make models in tests | |
user.first_name = nil | |
user.should_not be_valid |
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
<xml> | |
<legList> | |
<propositionNumber></propositionNumber> | |
<selectionList></selectionList> | |
</legList> | |
<legList> | |
<propositionNumber></propositionNumber> | |
<selectionList></selectionList> | |
</legList> | |
</xml> |
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
Traceback (most recent call last): | |
File "./sublime_plugin.py", line 175, in on_load | |
File "./sublime_plugin.py", line 154, in run_timed_function | |
File "./sublime_plugin.py", line 174, in <lambda> | |
File "./syntax_highlighting.py", line 24, in on_load | |
NameError: global name 'set_syntax' is not defined |
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
ActiveRecord::Base.class_eval do | |
alias :update_attribute, :update_column | |
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
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
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 create | |
resource = warden.authenticate!(:scope => resource_name, :recall => "new") | |
respond_to do |format| | |
format.html do | |
sign_in_and_redirect(resource_name, resource) | |
set_flash_message :notice, :signed_in | |
end | |
format.xml do | |
sign_in(resource_name, resource) | |
render :create |
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
namespace :db do | |
desc "Set Sequences to the correct value" | |
task :set_sequences => [:environment] do | |
tables = ActiveRecord::Base.connection.tables | |
tables.reject! { |t| t =~ /schema_migrations/ } | |
tables.each do |table| | |
max_id = table.classify.constantize.maximum(:id) || 1 | |
puts "Setting id sequence for #{table} to #{max_id}" | |
ActiveRecord::Base.connection.execute("select setval('#{table}_id_seq', #{max_id})") |
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
Spork.prefork do | |
require 'cucumber/rails' | |
require 'factory_girl_rails' | |
require 'factory_girl/step_definitions' | |
require 'database_cleaner' | |
require 'database_cleaner/cucumber' | |
Capybara.default_selector = :css | |
Capybara.default_driver = :selenium | |
Capybara.server_port = "9887" | |
Capybara.default_host = "http://www.lvh.me" |
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 should_see(content_array) | |
content_array.each { |text| page.should have_content(text) } | |
end | |
def should_not_see(content_array) | |
content_array.each { |text| page.should_not have_content(text) } | |
end | |
def should_be_on(page) | |
current_path = URI.parse(current_url).path |
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
sroot /Developer/SDKs/MacOSX10.7.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=Invalid argument} | |
2011-10-17 22:11:05.485 xcodebuild[27904:4103] Warning: Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'. | |
Compiler: /Developer/usr/bin/gcc-4.2 | |
Reason: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c -c /dev/null 2>&1 | |
=== BUILD NATIVE TARGET PSMTabBarControlFramework OF PROJECT PSMTabBarControl WITH THE DEFAULT CONFIGURATION (Release) === | |
Check dependencies | |
Unsupported compiler 'GCC 4.2' selected for architecture 'x86_64' | |
** BUILD FAILED ** |