Created
January 20, 2011 20:50
-
-
Save dokipen/788636 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| $:.unshift(File.expand_path('../../../lib',__FILE__)) | |
| require 'embedly' | |
| Given /an embedly endpoint( [^\s]+)?( with ([^\s]+) key)?$/ do |endpoint, _, key| | |
| opts = {} | |
| opts[:endpoint] = endpoint | |
| opts[:key] = key | |
| @api = Embedly::API.new opts | |
| end | |
| When /oembed is called with the (.*) URLs?( and ([^\s]+) flag)?$/ do |urls, _, flag| | |
| urls = urls.split(',') | |
| opts = {} | |
| if urls.size == 1 | |
| opts[:url] = urls.first | |
| else | |
| opts[:urls] = urls | |
| end | |
| opts[flag.to_sym] = true if flag | |
| @result = @api.oembed opts | |
| end | |
| Then /([^\s]+) should be ([^\s]+)/ do |key, value| | |
| if @result.is_a?Array | |
| @result.collect{|o| o.send(key).to_s}.join(',').should == value | |
| else | |
| @result.send(key).to_s.should == value | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment