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
diff --git features/command_line/exit_status.feature features/command_line/exit_status.feature | |
index b0c23f8..070831f 100644 | |
--- features/command_line/exit_status.feature | |
+++ features/command_line/exit_status.feature | |
@@ -47,3 +47,13 @@ Feature: exit status | |
""" | |
1 example, 1 failure | |
""" | |
+ | |
+ Scenario: exit with 0 when no examples are run |
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
# Instead of this: | |
name = 'Justin' | |
Person.where('name = ? OR display_name = ? OR cool_name = ? OR alias = ?', name, name, name, name) | |
# You can do | |
name = 'Justin' | |
Person.where('name = ? OR display_name = ? OR cool_name = ? OR alias = ?', *[name]*4) |
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 Raise | |
def self.raiser | |
1.join | |
end | |
def self.the_caller | |
raiser | |
rescue => exception | |
raise RuntimeError, "My custom message: #{exception.message}", exception.backtrace | |
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
- bar | |
- dog | |
- foo | |
- c: | |
- rat | |
- cat | |
- dog | |
- a | |
- b |
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 MyGem | |
class << self | |
attr_accessor :color | |
end | |
def self.configure(&block) | |
instance_eval(&block) | |
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
class Storage | |
attr_reader :elements | |
def initialize | |
@elements = {}.tap do |elements| | |
elements[:people] = [] | |
elements[:places] = [] | |
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
html = "".tap do |str| | |
str << '<table>' | |
str << '<tr>' | |
str << '<td>' | |
str << 'a' | |
str << '</td>' | |
str << '<td>' | |
str << 'b' | |
str << '</td>' | |
str << '</tr>' |
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
RSpec.configure do |config| | |
config.filter_run_excluding :remote => true | |
config.before :each, :remote => true do | |
# Configure code to hit the Braintree service | |
end | |
end | |
# Include your remote specs within your "normal" specs | |
describe Sweeper do |
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
# Replaces `for_groups_matching` | |
RSpec.configure do |config| | |
config.shared :type => :model do | |
let(:foo) { 'only in models' } | |
end | |
end | |
# I'm actually against being able to call `shared` | |
# on the configuration instance. It's just not needed. | |
# You could achieve the same by doing this: |
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
expect(true) == true | |
expect(true).to be_true | |
expect { true }.to eq(true) | |
expect { true }.to be_true |
OlderNewer