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 HarmonyHelpers | |
| def haromeny_page | |
| anchor = URI.parse(root_url).merge(current_url).fragment | |
| Harmony::AnchoredPage.new(current_page_body, anchor) | |
| end | |
| end | |
| module Harmony | |
| class Page | |
| module Window |
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 Cucumber | |
| module Ast | |
| class StepInvocation | |
| def accept_with_logging(visitor) | |
| if defined?(::Rails) | |
| ::Rails.logger.debug "*** Starting Cucumber Step: #{name} ***" | |
| end | |
| accept_without_logging(visitor) | |
| if defined?(::Rails) | |
| ::Rails.logger.debug "*** Done With Cucumber Step: #{name} ***" |
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
| // clear inputs with starter values | |
| new function($) { | |
| $.fn.prefilledInput = function() { | |
| var focus = function () { | |
| $(this).removeClass('prefilled'); | |
| if (this.value == this.prefilledValue) { | |
| this.value = ''; | |
| } | |
| }; |
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
| When %{I follow "$link_text" closest to "$reference_text"} do |link_text, reference_text| | |
| link_element = closest_to(reference_text, %{.//a[contains(., "#{link_text}")]}) | |
| link = Webrat::Link.load(webrat_session, link_element) | |
| link.click | |
| end | |
| module ClosestTo | |
| def closest_to(reference_text, selector) | |
| elements = current_dom.search("h1, h2, h3, h4, h5, h6, td, li, p") | |
| reference_element = elements_directly_containing(reference_text).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
| notify_deploy_environments = %w(staging production) | |
| notify_deploy_roles = %w(solo app_master) | |
| if notify_deploy_environments.include?(@configuration[:environment]) && notify_deploy_roles.include?(node['instance_role']) | |
| # Notify Hoptoad of deploy | |
| run "cd #{release_path} && rake hoptoad:deploy TO=#{@configuration[:environment]} REVISION=#{@configuration[:revision]} REPO=#{@configuration[:repository]}" | |
| 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
| Factory.define :post do |post_factory| | |
| post_factory.user { Factory.build(:user) } | |
| 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 Topic, "newest ordered by creation" do | |
| factory :first_topic, :topic, :created_at => 3.days.ago | |
| factory :second_topic, :topic, :created_at => 2.days.ago | |
| factory :third_topic, :topic, :created_at => 1.day.ago | |
| factory :fourth_topic, :topic, :created_at => 1.day.ago | |
| it "should be able to find the newest topics" do | |
| Topic.newest.map.should == [fourth_topic, | |
| third_topic, | |
| second_topic, |
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
| Before do | |
| Capybara.current_session.driver.rack_mock_session.after_request do | |
| body = Capybara.current_session.driver.response.body | |
| if match = body.match(%r{<\w+(?:\s+\w+\s*=\s*"[^&]+")*\s*/?>}) | |
| puts "WARNING: escaped tag: " + | |
| match[0].gsub("<", "<").gsub(">", ">").gsub(""", '"') | |
| end | |
| if match = body.match(%r{&(\w+);}) |
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
| FactoryGirl.define do | |
| sequence :email do |n| | |
| "user#{n}@example.com" | |
| end | |
| factory :user do | |
| password "test" | |
| aliased_as :author | |
| 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 Message do | |
| create :account, :name => "My Account" do | |
| create :user | |
| create :project | |
| with :project, :user => :author do | |
| create :message | |
| end | |
| end |