Skip to content

Instantly share code, notes, and snippets.

View ihoka's full-sized avatar

Istvan Hoka ihoka

View GitHub Profile
#!/bin/sh
./balsamiq_export.sh
module FormtasticHelpers
# Verifies that date elements (year, month, day) exist on the current page,
# for a form built with Formtastic.
def select_formtastic_date(date_to_select, options={})
date = date_to_select.is_a?(Date) || date_to_select.is_a?(Time) ?
date_to_select : Date.parse(date_to_select)
label = options[:from]
doc = Nokogiri::HTML(response.body)
def resource_to(page_name, record)
case page_name
when /the model page/
url_for(record)
when /the answers page/
question_answers_path(record)
else
raise "Can't find mapping from \"#{page_name}\" to a resource.\n" +
"Now, go and add a mapping in #{__FILE__}"
select * from objectives where company_id = 2
union
select * from objectives
where (concat(coalesce(area_group, '-'), '|', key_result) not in
(select concat(coalesce(area_group, '-'), '|', key_result) from objectives where company_id = 2))
and (company_id is null)
def textilize(text, *options)
options ||= [:hard_breaks]
if text.blank?
""
else
textilized = RedCloth.new(text, options)
textilized.to_html
end
end
@wip
Scenario Outline: Filtering sample key results # features/appraisal_setup/listing_sample_key_results.feature:20
Given I am on the appraisal setup page # features/step_definitions/webrat_steps.rb:6
When I fill in "<field>" with "<value>" # features/step_definitions/webrat_steps.rb:28
And I press "Filter" # features/step_definitions/webrat_steps.rb:14
Then I should see "<found>" in table "sample_key_results" # features/step_definitions/webrat_steps.rb:188
And I should not see "<not_found>" in table "sample_key_results" # features/step_definitions/webrat_steps.rb:196
Examples:
| field | value | found | not_found |
describe "handling DELETE destroy" do
before(:each) do
@user_session = mock_model(UserSession, :record => mock_model(User))
UserSession.stub!(:find).and_return(@user_session)
@user_session.stub!(:destroy)
end
def do_delete
delete :destroy
end