Skip to content

Instantly share code, notes, and snippets.

@jaredatron
Created May 5, 2009 20:38
Show Gist options
  • Select an option

  • Save jaredatron/107184 to your computer and use it in GitHub Desktop.

Select an option

Save jaredatron/107184 to your computer and use it in GitHub Desktop.
diff --git a/features/step_definitions/challenge_creation_wizard_page_steps.rb b/features/step_definitions/challenge_creation_wizard_page_steps.rb
index 5a49295..477bb46 100644
--- a/features/step_definitions/challenge_creation_wizard_page_steps.rb
+++ b/features/step_definitions/challenge_creation_wizard_page_steps.rb
@@ -3,7 +3,7 @@ When /^I enter "([^\"]+)" into the game field$/ do |game_name|
fill_in("challenge_game_id", :with => game.param)
end
-When /^I enter that game''?s title into the game field$/ do
+When Regexp.new('^I enter that game\'s title into the game field$') do
fill_in("challenge_game_id", :with => @game.param)
end
diff --git a/features/step_definitions/game_steps.rb b/features/step_definitions/game_steps.rb
index f5d5ca9..4565087 100644
--- a/features/step_definitions/game_steps.rb
+++ b/features/step_definitions/game_steps.rb
@@ -5,16 +5,6 @@ Given /^(\w+) has played the game (.+)$/ do |gamername, game_title|
user.save!
end
-# Given /^the game "([^\"]*)" has no objectives$/ do |game_name|
-# @game = Game.find_by_name!(game_name)
-#
-# mock_game_objective_types(@game, [])
-# end
-
-# Given /^that game has no objectives$/ do
-# mock_game_objective_types(@game, [])
-# end
-
Given /^game objectives(?: (do|do not))? exist for (?:the|that) game(?: "([^\"]*)")?$/ do |exist, game_name|
game = game_name.present? ? Game.find_by_name!(game_name) : @game
if exist.eql?('do not')
@@ -24,13 +14,6 @@ Given /^game objectives(?: (do|do not))? exist for (?:the|that) game(?: "([^\"]
end
end
-# Given /^game objectives exist for the game "([^\"]*)"$/ do |game_name|
-# mock_3_game_objective_types_for Game.find_by_name!(game_name)
-# end
-
-
-
-
def mock_0_game_objective_types_for(game)
mock_game_objective_types(game, [])
end
diff --git a/lib/core_ext.rb b/lib/core_ext.rb
index 5ddd7ea..7dbb4d9 100644
--- a/lib/core_ext.rb
+++ b/lib/core_ext.rb
@@ -166,3 +166,9 @@ class Object
Rails.logger.debug s if defined? Rails
end
end
+
+class Regexp
+ def to_proc
+ lambda {|*args| args.shift.match(self)}
+ end
+end
diff --git a/spec/models/challenge_spec.rb b/spec/models/challenge_spec.rb
index f00d90a..6c68bdf 100644
--- a/spec/models/challenge_spec.rb
+++ b/spec/models/challenge_spec.rb
@@ -138,6 +138,7 @@ describe Challenge do
Factory.build(:user),
Factory.build(:user),
]
+ # this is needed because we need the UUIDs
@users.each(&:save!)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment