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
| window.variableDefinedByGist = "foo!"; |
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
| {} |
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 'fileutils' | |
| NPM_2 = File.expand_path('./npm/2.15.2/package/bin/npm-cli.js') | |
| NPM_3 = File.expand_path('./npm/3.8.5/package/bin/npm-cli.js') | |
| describe 'npm', :vcr do | |
| def run!(*command) | |
| Kernel.system(*command) || raise("Command exited with status #{$?}") | |
| 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
| --color | |
| --format progress |
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
| describe 'some destructive method' do | |
| it 'destroys only relevant things' do | |
| expect { do_something_destructive }.to change { things_to_destroy.reload.count }.to(0) | |
| .and.not_to change { things_not_to_destroy.reload.count } | |
| # ^^^^^^^ This is what I want to do and just a fictional syntax. | |
| 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
| # Run `ruby gemfile_version_specifier.rb` in project root directory. | |
| require 'astrolabe/builder' | |
| require 'parser/current' | |
| require 'bundler' | |
| source_buffer = Parser::Source::Buffer.new('Gemfile') | |
| source_buffer.read | |
| builder = Astrolabe::Builder.new |
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 Foo | |
| class Bar | |
| BAZ = 'Hello' | |
| def print_module_nesting | |
| p Module.nesting | |
| end | |
| 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
| # coding: utf-8 | |
| require 'tmpdir' | |
| require 'parser/current' | |
| def in_tmpdir | |
| Dir.mktmpdir do |tmpdir| | |
| Dir.chdir(tmpdir) do | |
| yield | |
| 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
| describe '`and_return` without arguments' do | |
| let(:obj) { double('obj') } | |
| context 'with `stub`' do | |
| context 'and `{ }` block' do | |
| it 'works properly' do | |
| obj.stub(:foo).and_return { | |
| 'a return value' | |
| } |
NewerOlder