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
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
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 ActionView | |
module Helpers | |
class FormBuilder | |
# code from rails 3.0 | |
def submit(value=nil, options={}) | |
value, options = nil, value if value.is_a?(Hash) | |
value ||= submit_default_value | |
@template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit")) | |
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
$ ruby starline.rb | |
357-SIG-Brass 500 ($98.50) 1000 ($163.50) Available: 04/29/2013 | |
9MM-Brass | |
9MMP-Brass | |
380-Auto-Brass 500 ($73.00) 1000 ($129.00) Available: 04/16/2013 | |
40-SandW-Brass | |
45-Auto-P-Brass | |
45-Auto-Brass |
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
pages= %w[CCIprimers REMprimers WINprimers accurate alliant hodgdon BEBullets HPBullets SPPBullets] | |
pages.each do |page| | |
doc = Nokogiri::HTML(open("http://www.powdervalleyinc.com/#{page}.shtml")) | |
doc.xpath('//form//table//tr').each_with_index do |row, index| | |
next if index < 2 |
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 'spec_helper' | |
feature 'Creating Projects' do | |
scenario "can create a project" do | |
visit '/' | |
click_link 'New Project' | |
fill_in 'Name', :with => 'TextMate 2' | |
fill_in 'Description', :with => 'A text-editor for OS X' | |
click_button 'Create Project' | |
expect(page).to have_content('Project has been created.') | |
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
erlang:memory(total). | |
%% GC all processes | |
[erlang:garbage_collect(Pid) || Pid <- processes()]. | |
[{K,V / math:pow(1024,3)} || {K,V} <- erlang:memory()]. | |
[{T, ets:info(T, memory)} || T <- ets:all()]. | |
[{T, mnesia:table_info(T, memory)} || T <- mnesia:system_info(tables)]. |
OlderNewer