<commit_before>require 'spec_helper'
require 'spree/core/current_order'

describe Spree::DistributorsController do
  include Spree::Core::CurrentOrder

  it "selects distributors" do
    d = create(:distributor)

    spree_get :select, :id => d.id

    order = current_order(false)
    order.distributor.should == d
    response.should be_redirect
  end
end<commit_msg>Add controller spec for deselecting distributors<commit_after>require 'spec_helper'
require 'spree/core/current_order'

describe Spree::DistributorsController do
  include Spree::Core::CurrentOrder

  before do
    stub!(:before_save_new_order)
    stub!(:after_save_new_order)
  end


  it "selects distributors" do
    d = create(:distributor)

    spree_get :select, :id => d.id
    response.should be_redirect

    order = current_order(false)
    order.distributor.should == d
  end

  it "deselects distributors" do
    d = create(:distributor)
    order = current_order(true)
    order.distributor = d
    order.save!

    spree_get :deselect
    response.should be_redirect

    order.reload
    order.distributor.should be_nil
  end
end
{'fraction_non_alphanumeric': 0.08617594254937164, 'fraction_numerical': 0.0, 'mean_word_length': 3.9776785714285716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2644271', 'n_tokens_mistral': 370, 'n_tokens_neox': 345, 'n_words': 82}