Sha256: 437935241f50291af40be00eca933b06d106d3790295aef76183a903f0a3028f

Contents?: true

Size: 992 Bytes

Versions: 4

Compression:

Stored size: 992 Bytes

Contents

class Spinach::Features::ApiNavigation < Spinach::FeatureSteps
  include API

  step 'I should be able to navigate to posts and authors' do
    api.links.posts.resource
    api.links['api:authors'].resource

    assert_requested :get, 'http://api.example.org/posts'
    assert_requested :get, 'http://api.example.org/authors'
  end

  step 'I search for a post with a templated link' do
    api.links.search.expand(q: 'something').resource
  end

  step 'the API should receive the request with all the params' do
    assert_requested :get, 'http://api.example.org/search?q=something'
  end

  step 'I load a single post' do
    @post = api.links.posts.links.last_post
  end

  step 'I should be able to access it\'s title and body' do
    @post.attributes.title.wont_equal nil
    @post.attributes.body.wont_equal nil
  end

  step 'I should also be able to access it\'s embedded comments' do
    comment = @post.embedded.comments.first
    comment.attributes.title.wont_equal nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hyperclient-0.4.0 features/steps/api_navigation.rb
hyperclient-0.3.2 features/steps/api_navigation.rb
hyperclient-0.3.1 features/steps/api_navigation.rb
hyperclient-0.3.0 features/steps/api_navigation.rb