adding RSpec tests

parent 9a1f25f8
source 'https://rubygems.org'
gem 'simplecov'
# Specify your gem's dependencies in mark.gemspec
gemspec
gem 'json'
gem 'resource_kit'
group :development, :test do
group :development, :spec do
gem 'minitest', '~> 5.8.3'
gem 'rspec'
end
\ No newline at end of file
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
task :default => :test
......@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest"
spec.add_development_dependency "rspec"
end
require "resource_kit"
require "dspace/version"
require "dspace/resources/community_resource"
module Dspace
# Your code goes here...
end
module Dspace; end
class CommunityResource < ResourceKit::Resource
module Dspace
module Resources
class CommunityResource < ResourceKit::Resource
resources do
action :all, 'GET /communities' do
handler(:success) do |response|
Dspace::Builders::ModelBuilder.build_communities(JSON.parse(response.body))
resources do
action :all, 'GET /communities' do
handler(200) do |response|
Dspace::Builders::ModelBuilder.build_communities(JSON.parse(response.body))
end
end
end
end
end
end
\ No newline at end of file
require 'spec_helper'
RSpec.describe Dspace::Resources::CommunityResource, resource_kit: true do
it 'has an all action' do
expect(Dspace::Resources::CommunityResource).to have_action(:all).that_handles(200).at_path('/communities')
end
#it 'handles a 201 with response body' do
# expect(MyResourceClass).to handle_response(:create).with(status: 201, body: '{"users":[]}') do |handled|
# expect(handled).to all(be_kind_of(User))
# end
#end
end
\ No newline at end of file
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "bundler"
Bundler.setup
require 'dspace'
require 'minitest/autorun'
require 'resource_kit/testing'
require 'dspace'
\ No newline at end of file
require 'test_helper'
class DspaceTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Dspace::VERSION
end
def test_it_does_something_useful
assert false
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment