Skip to content
Browse files

Merge pull request #398 from rubygems/subscription_steps

Add features for subscriptions.
  • Loading branch information...
2 parents 68eef6a + d275652 commit 9b970b5f49f6ea0c5993df6844606f7ed7fc678e @sferik sferik committed Feb 4, 2012
Showing with 35 additions and 0 deletions.
  1. +7 −0 features/step_definitions/subscription_steps.rb
  2. +28 −0 features/subscription.feature
View
7 features/step_definitions/subscription_steps.rb
@@ -0,0 +1,7 @@
+Then /^I should be subscribed to "([^"]*)"$/ do |name|
+ assert @me.subscribed_gems.include?(Rubygem.find_by_name(name))
+end
+
+Then /^I should be unsubscribed to "([^"]*)"$/ do |name|
+ assert !@me.subscribed_gems.include?(Rubygem.find_by_name(name))
+end
View
28 features/subscription.feature
@@ -0,0 +1,28 @@
+@javascript
+Feature: Subscription
+
+ Background:
+ Given I have signed in with "bob@example.com"
+ And the following rubygems exist:
+ | name |
+ | sandworm |
+ And the following versions exist:
+ | rubygem | number | platform |
+ | name: sandworm | 2.0.0 | ruby |
+
+ Scenario: User subscribes
+ When I visit the gem page for "sandworm"
+ Then I should see "Subscribe"
+ When I follow "Subscribe"
+ Then I should be subscribed to "sandworm"
+ And I should see "Unsubscribe"
+
+ Scenario: User unsubscribes
+ Given the following subscriptions exist:
+ | user | rubygem |
+ | email: bob@example.com | name: sandworm |
+ When I visit the gem page for "sandworm"
+ Then I should see "Unsubscribe"
+ When I follow "Unsubscribe"
+ Then I should be unsubscribed to "sandworm"
+ And I should see "Subscribe"

0 comments on commit 9b970b5

Please sign in to comment.
Something went wrong with that request. Please try again.