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
module ApiRequests | |
def self.post_json_to_url input_url, json_body | |
begin | |
@response = RestClient.post(input_url, json_body, :content_type => 'application/json') | |
rescue Exception => e | |
raise e.response | |
end | |
parse_response_body(@response) | |
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
require 'uri' | |
require 'open-uri' | |
require 'net/ftp' | |
uri = URI.parse('ftp://User@Server') | |
Net::FTP.open(uri.host) do |ftp| | |
ftp.login 'username', 'password' | |
ftp.passive = true | |
puts ftp.pwd | |
ftp.chdir('home/test') |
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
Feature: greeter says hello | |
In order to start learning RSpec and Cucumber | |
As a reader of The RSpec Book | |
I want a greeter to say Hello | |
Scenario: Greeter says hello | |
Given a greeter | |
When I send it the greet message | |
Then I should see "Hello Cucumber!" |
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
describe Example do | |
context '.create' do | |
it 'receives a call to create method' do | |
expect(described_class.create).to | |
receive(create) | |
.with('something') | |
end | |
end | |
context '.example' do |
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
describe 'Tasks API' do | |
before :each do | |
FactoryGirl.create :project | |
Project.last.integrations << Integration.last | |
end | |
# GET /tasks/:id | |
it 'should return a single task' do | |
api_get "tasks/#{Task.last.id}", {token: Integration.last.user.api_key.token} |
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
require 'rubygems' | |
require 'sinatra' | |
get '/' do | |
home = Dir.chdir("/features") | |
File.read(File.join('home', "#{home}")) | |
end | |