aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Räty <betelgeuse@gentoo.org>2011-03-12 19:50:20 +0200
committerPetteri Räty <betelgeuse@gentoo.org>2011-03-12 19:50:20 +0200
commit151c361a71c0b663c44c6bf5f7d310f1f12a87af (patch)
tree0cfd1511c28da5eb670f867f95b2508a2e361d20 /features
parentFix deprecation warnings from delayed_job (diff)
downloadrecruiting-webapp-151c361a71c0b663c44c6bf5f7d310f1f12a87af.tar.gz
recruiting-webapp-151c361a71c0b663c44c6bf5f7d310f1f12a87af.tar.bz2
recruiting-webapp-151c361a71c0b663c44c6bf5f7d310f1f12a87af.zip
Rename QuestionCategory to Category
We have a need for a many to many between questions and categories so start the work by renaming QuestionCategory to just Category. This allows us to add a pivot model with the name QuestionCategory.
Diffstat (limited to 'features')
-rw-r--r--features/step_definitions/categories_steps.rb3
-rw-r--r--features/step_definitions/question_categories_steps.rb6
-rw-r--r--features/step_definitions/questions_steps.rb4
-rw-r--r--features/step_definitions/users_steps.rb10
4 files changed, 10 insertions, 13 deletions
diff --git a/features/step_definitions/categories_steps.rb b/features/step_definitions/categories_steps.rb
new file mode 100644
index 0000000..66eee68
--- /dev/null
+++ b/features/step_definitions/categories_steps.rb
@@ -0,0 +1,3 @@
+Given /^a category "([^\"]*)"$/ do |name|
+ @category = Category.find_by_name(name) || Category.create!(:name => name)
+end
diff --git a/features/step_definitions/question_categories_steps.rb b/features/step_definitions/question_categories_steps.rb
deleted file mode 100644
index e5d34e1..0000000
--- a/features/step_definitions/question_categories_steps.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-Given /^a question category "([^\"]*)"$/ do |name|
- @question_category = QuestionCategory.find_by_name(name)
- if @question_category.nil?
- @question_category = QuestionCategory.create!(:name => name)
- end
-end
diff --git a/features/step_definitions/questions_steps.rb b/features/step_definitions/questions_steps.rb
index fce0762..b0cd6fd 100644
--- a/features/step_definitions/questions_steps.rb
+++ b/features/step_definitions/questions_steps.rb
@@ -11,8 +11,8 @@ end
Given /^a question "([^\"]*)" in category "([^\"]*)"$/ do |title, category|
Given "a question \"#{title}\""
- Given "a question category \"#{category}\""
- @question.question_category = @question_category
+ Given "a category \"#{category}\""
+ @question.category = @category
@question.save!
end
diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb
index 932e538..9b66f29 100644
--- a/features/step_definitions/users_steps.rb
+++ b/features/step_definitions/users_steps.rb
@@ -14,9 +14,9 @@ end
Given /^user "([^\"]*)" has category "([^\"]*)"$/ do |user_name, category_name|
Given "user \"#{user_name}\""
- Given "a question category \"#{category_name}\""
- unless @user.question_categories.include?(@question_category)
- @user.question_categories.push(@question_category)
+ Given "a category \"#{category_name}\""
+ unless @user.categories.include?(@category)
+ @user.categories.push(@category)
end
@user.save!
end
@@ -30,8 +30,8 @@ Given /^"([^\"]*)" answered question "([^\"]*)"$/ do |user, question|
end
Given /^user "([^\"]*)" answered all questions in "([^\"]*)"$/ do |user_name, category_name|
- Given "a question category \"#{category_name}\""
- for q in @question_category.questions
+ Given "a category \"#{category_name}\""
+ for q in @category.questions
if q.question_group.nil?
Given "\"#{user_name}\" answered question \"#{q.title}\""
end