File: creatives_to_follow_spec.rb

package info (click to toggle)
ruby-behance 0.6.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,344 kB
  • sloc: ruby: 715; makefile: 4
file content (44 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'spec_helper'

describe Behance::Client::CreativesToFollow do

  before(:all) do
    @client = Behance::Client.new(access_token: "abc123")
  end

  before do
    @options = { api_key: @client.access_token }
  end

  describe "#creatives_to_follow" do
    context "without parameters" do
      before do
        stub_get("creativestofollow").with(query: @options).
          to_return(body: fixture("creatives_to_follow.json"))
        @creatives_to_follow = @client.creatives_to_follow
      end

      it "makes a http request" do
        a_get("creativestofollow").
          with(query: @options).should have_been_made
      end

      it "gets a list of creatives to follow" do
        @creatives_to_follow.size.should == 10
      end
    end

    context "with parameters" do
      before do
        @options.merge!(page: 2)
        stub_get("creativestofollow").with(query: @options).
          to_return(body: fixture("creatives_to_follow.json"))
      end

      it "gets a list of creatives to follow" do
        @creatives_to_follow = @client.creatives_to_follow(@options).size.
          should == 10
      end
    end
  end
end