Sha256: c4f37622d99beb77ff99ba1b470865efb90b1b76e0d06ed6bfa0200f7a517a02

Contents?: true

Size: 846 Bytes

Versions: 25

Compression:

Stored size: 846 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") { |env| [200, {}, { :id => 1, :name => "Tobias Fünke" }.to_json ] }
          stub.get("/users/1/fish") { |env| [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

25 entries across 25 versions & 4 rubygems

Version Path
test_track_rails_client-2.0.0 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-1.3.0 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-1.2.0 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-1.1.0 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-1.0.0 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.20 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.19 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.18 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.17 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.16 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.15 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.14 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.13 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.12 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.11 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.10 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.9 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
test_track_rails_client-0.9.8 vendor/gems/her/spec/model/associations/association_proxy_spec.rb
her-0.8.2 spec/model/associations/association_proxy_spec.rb
her5-0.8.2 spec/model/associations/association_proxy_spec.rb