<commit_before>require 'spec_helper'

describe "Sales Requests" do
  describe "GET /sales" do
    it "returns the expected response code and headers" do
      get sales_path
      response.status.should be(200)
    end
  end
end
<commit_msg>temp check-in: potential rails defect?<commit_after>require 'spec_helper'

#
# Integration tests for Sale JSON api rooted at /sales
#
describe "Sales Requests" do

  before :each do
	Item.delete_all
	Sale.delete_all
  end
  after :each do check_headers(response) end
  let(:uri) { '/sales.json' }

  describe 'GET /sales.json' do
    it 'responds with 200 and expected basic headers' do
      get uri
      response.status.should be(OK_200)
    end
  end

  describe 'POST /sales.json' do
	it 'can correctly create a new sale associated to a given item' do
	  # Although we could use POST here, ActiveRecord is used for diversity (items_spec uses post)
	  item = Item.create(:brand => 'merc', :year => 2013)
	  Item.find_by_brand_and_year('merc', 2013).should_not be_nil
	  post uri, :sale => { :item_id => item.id, :paid => 12.34 }
	  response.status.should == CREATED_201
	  # wanna see a funny Rails defect? uncomment this:
	  # puts response
	end
  end
end

{'fraction_non_alphanumeric': 0.08985024958402663, 'fraction_numerical': 0.019966722129783693, 'mean_word_length': 3.4888059701492535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '4198825', 'n_tokens_mistral': 423, 'n_tokens_neox': 376, 'n_words': 139}