Skip to content

Commit

Permalink
fix da merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ingridh committed Apr 18, 2015
2 parents 7c460a7 + ee5aa06 commit f63ed55
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# git config --global core.excludesfile ~/.gitignore_global

text.rb
saasquizes_test
coursequestionbank_test
# Ignore bundler config
/.bundle

Expand Down
12 changes: 6 additions & 6 deletions app/controllers/upload_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def upload
redirect_to upload_path
return
end
if collections.nil? || collections.empty?
flash[:notice] = 'The file you uploaded does not contain any quizzes'
flash.keep
redirect_to upload_path
return
end
# if collections.nil? || collections.empty?
# flash[:notice] = 'The file you uploaded does not contain any quizzes'
# flash.keep
# redirect_to upload_path
# return
# end
flash.keep
redirect_to finalize_upload_path(:ids => collections.map{|collection| collection.id})
end
Expand Down
19 changes: 17 additions & 2 deletions features/collections.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,29 @@ Feature: collections that we can add problems to
Then I should be on the dashboard
And I add problem containing 'Raffi' to collection 'yolo'
And I should see Collection 'yolo' in the database
And I remove problem containing 'Raffi' to collection 'yolo'
Then I should not see 'Raffi' in collection 'yolo'

Scenario: remove a problem
When I follow "start a new collection"
And I fill in "collection_name" with "yolo"
And I press "Create Collection"
Then I should be on the dashboard
And I add problem containing 'lifetime' to collection 'yolo'
And I should see Collection 'yolo' in the database
And I remove problem containing 'lifetime' to collection 'yolo'
Then I should not see 'lifetime' in collection 'yolo'

Scenario: add a new question to current collection
When I create a new collection 'yolo' and mark it as current
And I add problem containing 'Raffi' to collection 'yolo'
Then I should see 'Raffi' with in the collection 'yolo'

Scenario: attempt to add an invalid problem to valid collection
When I create a new collection 'yolo'
Then I add the problemid '0' to collection 'yolo'


Scenario: upload same file twice
Given I am on the upload page
And I attach the file "features/test_files/foo.txt" to "file_upload"
Expand All @@ -37,5 +54,3 @@ Feature: collections that we can add problems to
Then I should be on the dashboard
And I should not see Collection 'apple' in the database



23 changes: 23 additions & 0 deletions features/export.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature: Export a collection
As an instructor
So I can publish a quiz
I want to be export a collection

Background:
Given I am signed in with uid "1234" and provider "github"
And I have uploaded 'micro_quizzes.txt'
And I am on the dashboard

Scenario: Export a quiz successfully
When I follow "1/22/15 (W1 L2)"
And I follow "export button"
Then I should see "1/22/15 (W1 L2)"

Scenario: Export a quiz unsuccessfully
When I follow "start a new collection"
And I fill in "collection_name" with "yolo"
And I press "Create Collection"
Then I should be on the dashboard
And I follow "yolo"
And I follow "export button"
Then I should see "Cannot export an empty collection! Add some questions to your collection"
15 changes: 14 additions & 1 deletion features/step_definitions/web_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def with_scope(locator)
assert data_class.find_by_name(name_value) #check this exists in database and is not nil
end



Given /^(?:|I )have uploaded '(.*)'$/ do |file|
steps %Q{
Given I am on the upload page
Expand Down Expand Up @@ -73,6 +75,18 @@ def with_scope(locator)
visit "/add_problem?collection_id=#{collection}&id=#{problem}"
end

When /^(?:|I )remove problem containing '(.*)' to collection '(.*)'/ do |problem_text, collection|
problem = Problem.all.select{|problem| problem.json.include? problem_text}[0].id
collection = Collection.find_by_name(collection).id
visit "/remove_problem?collection_id=#{collection}&id=#{problem}"
end


Then /^(?:|I )should not see '(.*)' in collection '(.*)'/ do |problem_text, collection|
collection = Collection.find_by_name(collection)
problem = Problem.all.select{|problem| problem.json.include? problem_text}[0]
assert !(collection.problems.include? problem)
end

Then /^(?:|I )should see '(.*)' with in the collection '(.*)'/ do |problem_text, collection|
collection = Collection.find_by_name(collection).id
Expand All @@ -87,7 +101,6 @@ def with_scope(locator)
assert data_class.find_by_name(name_value).nil?
end


Given /^(?:|I )am looking at edit page regarding collection '(.*)'/ do |collection|
collection = Collection.find_by_name(collection).id
visit edit_collection_path(:id => collection)
Expand Down
2 changes: 1 addition & 1 deletion features/test_files/micro_quizzes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,4 @@ quiz '3/7 version control' do
end


end
end
10 changes: 10 additions & 0 deletions features/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,14 @@ Scenario: syntax error in the file
And I press "upload"
Then I should see "There is an error in the file"

Scenario: upload same file twice
Given I am on the upload page
And I attach the file "features/test_files/foo.txt" to "file_upload"
And I press "upload"
Given I am on the upload page
And I attach the file "features/test_files/foo.txt" to "file_upload"
And I press "upload"
Then I should see "There is an error in the file: Quiz with that name already exists in your list of collections. You probably didn't mean to upload the same quiz again. Try deleting the old collection and upload again if you really meant to do that"



0 comments on commit f63ed55

Please sign in to comment.