forked from ehrenmurdick/gnap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ehren Murdick
committed
May 6, 2009
1 parent
c4b86e9
commit f92ee99
Showing
6 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Feature: Filters | ||
Background: | ||
Given I have a gnap connection | ||
And I have the "delicious" publisher | ||
|
||
Scenario: Getting a named filter | ||
Then I should be able to get the "bazqux" filter | ||
|
||
Scenario: Creating a filter | ||
Then I should be able to create filter "foobar" | ||
|
||
Scenario Outline: Adding rules | ||
Then I should be able to create filter "foobar" | ||
And add an "<type>" rule with a value of "<value>" | ||
Examples: | ||
| type | value | | ||
| actor | steve | | ||
| tag | election | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Given /^I have the "([^\"]*)" publisher$/ do |publisher| | ||
@publisher = @gnap.publisher(publisher) | ||
end | ||
|
||
Then /^I should be able to get the "([^\"]*)" filter$/ do |filter| | ||
@publisher.filter(filter).should be_kind_of(Gnap::Filter) | ||
end | ||
|
||
Then /^I should be able to create filter "([^\"]*)"$/ do |name| | ||
@publisher.should_receive(:post).with("/gnip/publishers/#{@publisher}/filters.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?><filter fullData=\"false\" name=\"#{name}\"><rule type=\"actor\">bazqux</rule></filter>") | ||
@filter = @publisher.create_filter!("foobar", :actor => "bazqux") | ||
end | ||
|
||
Then /^add an "([^\"]*)" rule with a value of "([^\"]*)"$/ do |type, value| | ||
@filter.should_receive(:post).with("/gnip/publishers/delicious/filters/#{@filter}/rules.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rules><rule type=\"#{type}\">#{value}</rule></rules>") | ||
@filter.add_rule!(type, value) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Given /^I have a gnap connection$/ do | ||
@gnap = Gnap.new('fakeuser', 'fakepassword') | ||
end | ||
|
||
Then /^there should be (\d*) notifications$/ do |n| | ||
@notifications.size.should == n.to_i | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,10 @@ def rules_path | |
"#{path}/rules.xml" | ||
end | ||
|
||
def to_s | ||
@filter | ||
end | ||
|
||
private | ||
|
||
def rules_to_xml doc, rules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters