File: fields_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 (50 lines) | stat: -rw-r--r-- 968 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
45
46
47
48
49
50
require 'spec_helper'

describe Behance::Client::Fields do

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

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

  describe "#fields" do

    before do
      stub_get("fields").with(query: @options).
        to_return(body: fixture("fields.json"))
      @fields = @client.fields
    end

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

    it "gets a fields list" do
      @fields.size.should == 67
    end

  end

  describe "#popular" do

    before do
      stub_get("fields").with(query: @options).
        to_return(body: fixture("fields.json"))
      @popular = @client.popular
    end

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

    it "gets a popular fields list" do
      @popular.size.should == 12
    end

  end
end