Sha256: bb92f2ce831d0e794480ff952dbe152368f13893652500225b40bb29fa40205d

Contents?: true

Size: 817 Bytes

Versions: 12

Compression:

Stored size: 817 Bytes

Contents

# encoding: utf-8
require "spec_helper"

describe Her::Model::Associations::AssociationProxy do
  describe "proxy assignment methods" do
    before do
      Her::API.setup url: "https://api.example.com" do |builder|
        builder.use Her::Middleware::FirstLevelParseJSON
        builder.use Faraday::Request::UrlEncoded
        builder.adapter :test do |stub|
          stub.get("/users/1") { [200, {}, { id: 1, name: "Tobias Fünke" }.to_json] }
          stub.get("/users/1/fish") { [200, {}, { id: 1, name: "Tobias's Fish" }.to_json] }
        end
      end
      spawn_model "User" do
        has_one :fish
      end
      spawn_model "Fish"
    end

    subject { User.find(1) }

    it "should assign value" do
      subject.fish.name = "Fishy"
      expect(subject.fish.name).to eq "Fishy"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
her-0.10.4 spec/model/associations/association_proxy_spec.rb
her-0.10.3 spec/model/associations/association_proxy_spec.rb
her-0.10.2 spec/model/associations/association_proxy_spec.rb
her-1.0.1 spec/model/associations/association_proxy_spec.rb
her-1.0.0 spec/model/associations/association_proxy_spec.rb
her-0.10.1 spec/model/associations/association_proxy_spec.rb
her-0.10.0 spec/model/associations/association_proxy_spec.rb
her-0.9.0 spec/model/associations/association_proxy_spec.rb
her-0.8.6 spec/model/associations/association_proxy_spec.rb
her-0.8.5 spec/model/associations/association_proxy_spec.rb
her-0.8.4 spec/model/associations/association_proxy_spec.rb
her-0.8.3 spec/model/associations/association_proxy_spec.rb