* VRFS-217 making sure REST API is stil the same
This commit is contained in:
parent
d219159e9e
commit
c47d2aed69
1
Gemfile
1
Gemfile
|
|
@ -36,7 +36,6 @@ gem 'gon' # for passthrough of Ruby variables to Javascript variables
|
|||
gem 'eventmachine', '1.0.0'
|
||||
gem 'amqp', '0.9.8'
|
||||
gem 'logging-rails', :require => 'logging/rails'
|
||||
gem 'tire', '0.5.1'
|
||||
gem 'omniauth', '1.1.1'
|
||||
gem 'omniauth-facebook', '1.4.1'
|
||||
gem 'fb_graph', '2.5.9'
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class ApiUsersController < ApiController
|
|||
end
|
||||
|
||||
def delete
|
||||
@user.destroy # required to make 'tire' integration work
|
||||
@user.destroy
|
||||
respond_with responder: ApiResponder, :status => 204
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -73,12 +73,6 @@ module SampleApp
|
|||
config.rabbitmq_host = "localhost"
|
||||
config.rabbitmq_port = 5672
|
||||
|
||||
# where is elasticsearch?
|
||||
config.elasticsearch_uri = "http://localhost:9200"
|
||||
# or 'verify' or 'none'. 'autorepair will automatically rebuild the elasticsearch index on startup of rails,
|
||||
# if an inconsistency is detected'
|
||||
config.elasticsearch_verify_mode = "autorepair"
|
||||
|
||||
# API key for filepicker.io gem
|
||||
config.filepicker_rails.api_key = "AhUoVoBZSLirP3esyCl7Zz"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
Tire.configure do
|
||||
logger Rails.root + "log/tire_#{Rails.env}.log"
|
||||
url Rails.application.config.elasticsearch_uri
|
||||
end
|
||||
|
||||
User.create_search_index unless User.search_index.exists?
|
||||
Band.create_search_index unless Band.search_index.exists?
|
||||
|
||||
# Verify elasticsearch integrity
|
||||
if Rails.application.config.elasticsearch_verify_mode == "autorepair"
|
||||
unless TireTasks.verify
|
||||
TireTasks.rebuild_indexes
|
||||
end
|
||||
elsif Rails.application.config.elasticsearch_verify_mode == "verify"
|
||||
TireTasks.verify
|
||||
end
|
||||
|
|
@ -9,11 +9,6 @@ describe "Search API", :type => :api do
|
|||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
before(:each) do
|
||||
Band.delete_search_index
|
||||
Band.create_search_index
|
||||
User.delete_search_index
|
||||
User.create_search_index
|
||||
|
||||
post '/sessions', "session[email]" => user.email, "session[password]" => user.password
|
||||
rack_mock_session.cookie_jar["remember_token"].should == user.remember_token
|
||||
end
|
||||
|
|
@ -25,16 +20,11 @@ describe "Search API", :type => :api do
|
|||
end
|
||||
|
||||
it "simple search" do
|
||||
User.delete_search_index # so that the user created before the test and logged in doesn't show up
|
||||
User.create_search_index
|
||||
@musician = FactoryGirl.create(:user, first_name: "Peach", last_name: "Nothing", email: "user@example.com", musician: true)
|
||||
@fan = FactoryGirl.create(:user, first_name: "Peach Peach", last_name: "Grovery", email: "fan@example.com", musician: false)
|
||||
@band = Band.save(nil, "Peach pit", "www.bands.com", "zomg we rock", "Apex", "NC", "USA", ["hip hop"], user.id, nil, nil)
|
||||
@band2 = Band.save(nil, "Peach", "www.bands2.com", "zomg we rock", "Apex", "NC", "USA", ["hip hop"], user.id, nil, nil)
|
||||
User.search_index.refresh
|
||||
Band.search_index.refresh
|
||||
|
||||
|
||||
|
||||
get '/api/search.json?query=peach'
|
||||
last_response.status.should == 200
|
||||
response = JSON.parse(last_response.body)
|
||||
|
|
@ -48,13 +38,13 @@ describe "Search API", :type => :api do
|
|||
fan["id"].should == @fan.id
|
||||
|
||||
response["bands"].length.should == 2
|
||||
band = response["bands"][0]
|
||||
band["id"].should == @band2.id
|
||||
band = response["bands"][1]
|
||||
band["id"].should == @band.id
|
||||
|
||||
bands = response["bands"]
|
||||
bands = [bands[0]["id"], bands[1]["id"]]
|
||||
bands.should include(@band.id)
|
||||
bands.should include(@band2.id)
|
||||
|
||||
response["recordings"].length.should == 0
|
||||
band = response["recordings"][0]
|
||||
recording = response["recordings"][0]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue