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 way a radio location/station can have many cities, countries and continents, e.g. | |
| # for a global online radio channel. | |
| # | |
| # A Radio Location can have just a city or country etc. | |
| # | |
| class RadioStation | |
| belongs_to :radio_location | |
| 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
| ENV["WATCHR"] = "1" | |
| system 'clear' | |
| def growl(message) | |
| growlnotify = `which growlnotify`.chomp | |
| title = "Watchr Test Results" | |
| puts message | |
| image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" | |
| options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
| system %(#{growlnotify} #{options} &) |
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
| # Source: | |
| # http://blog.madebydna.com/all/code/2010/06/04/ruby-helper-to-cleanly-truncate-html.html | |
| require "rubygems" | |
| require "nokogiri" | |
| module TextHelper | |
| def truncate_html(text, max_length, ellipsis = "...") | |
| ellipsis_length = ellipsis.length |
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
| gem 'cover_me', '>= 1.0.0.rc6', :group => :test |
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
| gem 'cover_me', '>= 1.0.0.rc6', :group => :test |
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
| namespace :cover_me do | |
| task :report do | |
| puts "Reporting!" | |
| CoverMe.config.formatter = CoverMe::EmmaFormatter | |
| CoverMe.config.at_exit = Proc.new {} | |
| CoverMe.complete! | |
| end | |
| end | |
| task :spec do |
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
| #!/bin/bash -l | |
| source "$HOME/.rvm/scripts/rvm" | |
| # Use the correct ruby | |
| rvm --create "1.9.2-p136@project" | |
| gem install bundler | |
| export RAILS_ENV=test | |
| export DISPLAY=:99 |
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
| # cumulative line chart | |
| cumulativeChart = buildCumulativeChart(rows, "start_date") | |
| cumulativeChart.addLine("CTR" ,"ctr") | |
| cumulativeChart.addLine("CR", "cr") | |
| cumulativeChart.addLine("ROI", "roi") | |
| cumulativeChart.draw("#chart1") | |
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 Credentials | |
| include Support::Base | |
| attribute :password, String | |
| attribute :password_confirmation, String | |
| with_options allow_blank: true do |v| | |
| v.validates :password, confirmation: { message: proc{ error_msg(:password, :passwords_dont_match) } } | |
| v.validates :password, length: { minimum: 8, maximum: 50, message: proc{ error_msg(:password, :invalid) } } | |
| # v.validates :password, format: { with: /[^[:alpha:]]/ } |
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 VotesController do | |
| describe "POST 'create'" do | |
| it "should return json success" do | |
| user_vote = stub_model(UserVote, :save => true) | |
| UserVote.stub(:new).with({ip_address: "127.0.0.1", mics: 2, round_id: 1, rapper_id: 1}) { user_vote } | |
| post :create, user_vote: { ip_address: "127.0.0.1", mics: 2, round_id: 1, rapper_id: 1 } |