This file contains hidden or 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 A | |
def method_one | |
"A: method_one" | |
end | |
private | |
class B | |
def method_one | |
"A::B: method_one" |
This file contains hidden or 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 'sphero' | |
require 'pry' | |
FORWARD = 0 | |
RIGHT = 90 | |
BACKWARD = 180 | |
LEFT = 270 | |
SLOW = 100 | |
FAST = 200 |
This file contains hidden or 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
#### | |
## super_gem.rb | |
module SuperGem | |
require 'super_gem/rails/patches' | |
# super stuff you couldn't even imagine ... | |
end | |
#### |
This file contains hidden or 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 Student < SecondBase::Base | |
has_and_belongs_to_many :courses | |
end | |
class Course < SecondBase::Base | |
has_and_belongs_to_many :students | |
end | |
student = Student.first |
This file contains hidden or 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
module ImSoConfused | |
def some_method; end | |
private | |
def another_method; end | |
end | |
public | |
def last_method; end |
This file contains hidden or 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
# If capybara cannot find your browser executable, you can give it a hint like so: | |
Selenium::WebDriver::Firefox.path='/Applications/Firefox.app/Contents/MacOS/firefox-bin' | |
Selenium::WebDriver::Chrome.path = "/opt/google/chrome/google-chrome" |
This file contains hidden or 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 SomeController | |
def service | |
resource = Locator.find(params[:id]) | |
if resource.blank? | |
render :status => 404, :text => "Resource could not be found" | |
else | |
render :json => resource | |
end | |
end |
This file contains hidden or 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
# The intention is to reduce boiler plate code by globally adding | |
# behavior to any of the defined CLASS LEVEL methods. | |
# | |
# Chained.foo => "first I was like: base foo, but then I was: chained foo | |
# Chained.foo_bar => "first I was like: base foo_bar, but then I was: chained foo_bar | |
# | |
# This is useful for, say, finder methods that you want to add global behavior | |
# too. Like if you want to always decorate a result set. | |
# | |
# This seems a bit crazy...ideas for improvement?? |
This file contains hidden or 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 Something | |
module Base | |
def my_method | |
# (A) original functionality | |
end | |
end | |
module PreExtension | |
def my_method | |
# (B) before the original |
This file contains hidden or 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
setup do | |
xhr :post, :summarize | |
end | |
should "find a tag" do | |
# FAILS in Rails3, SUCCEEDS in Rails2 | |
assert_select :span, :text => "some content" | |
# SUCCEEDS in Rails3 & Rails2 | |
assert_match /\<span\>some content<\/span\>/, @response.body |
NewerOlder