Skip to content

Commit

Permalink
added trash collection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ingridh committed Apr 18, 2015
1 parent d960c42 commit 7c460a7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Binary file modified coursequestionbank_test
Binary file not shown.
9 changes: 8 additions & 1 deletion features/collections.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Feature: collections that we can add problems to
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: create a new collection
Expand All @@ -31,4 +30,12 @@ Feature: collections that we can add problems to
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"

Scenario: delete a collection
When I create a new collection 'apple'
Given I am looking at edit page regarding collection 'apple'
When I press the trash icon at 'apple'
Then I should be on the dashboard
And I should not see Collection 'apple' in the database



16 changes: 16 additions & 0 deletions features/step_definitions/web_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,24 @@ def with_scope(locator)
}
end

Then /^(?:|I )should not see (.*) '(.*)' in the database$/ do |datatype, name_value|
data_class = Object.const_get(datatype)
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)
end

When /^I press the trash icon at '(.*)'/ do |collection|
collection = Collection.find_by_name(collection)
visit edit_collection_path(:id => collection)
steps %Q{
Then I follow "trash_can_icon"
}
end

Given /^(?:|I )am on (.+)$/ do |page_name|
visit path_to(page_name)
Expand Down

0 comments on commit 7c460a7

Please sign in to comment.