Sha256: 226bce4de7fd2ba43143eb28e43bcf67aa1ff12723f5498055d30e669d930f91

Contents?: true

Size: 853 Bytes

Versions: 7

Compression:

Stored size: 853 Bytes

Contents

require "spec_helper"
require "ribose/actions/create"

RSpec.describe "TestCreateAction" do
  describe ".create" do
    it "creates a new resource with provided details" do
      stub_ribose_space_create_api(space_attributes)
      space = Ribose::TestCreateAction.create(space_attributes)

      expect(space.id).not_to be_nil
      expect(space.name).to eq("Trip to the Mars")
      expect(space.visibility).to eq("invisible")
    end
  end

  def space_attributes
    {
      access: "private",
      space_category_id: 12,
      description: "The long awaited dream!",
      name: "Trip to the Mars",
    }
  end

  module Ribose
    class TestCreateAction < Ribose::Base
      include Ribose::Actions::Create

      private

      def resource
        "space"
      end

      def resources
        [resource, "s"].join
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ribose-0.5.0 spec/ribose/actions/create_spec.rb
ribose-0.4.1 spec/ribose/actions/create_spec.rb
ribose-0.4.0 spec/ribose/actions/create_spec.rb
ribose-0.3.2 spec/ribose/actions/create_spec.rb
ribose-0.3.1 spec/ribose/actions/create_spec.rb
ribose-0.3.0 spec/ribose/actions/create_spec.rb
ribose-0.2.0 spec/ribose/actions/create_spec.rb