Add integration tests for mobile polls and locations
This commit is contained in:
parent
6fafa731e6
commit
79dfdfa224
2 changed files with 34 additions and 0 deletions
|
|
@ -99,6 +99,12 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
factory(:status_message_with_location) do
|
||||||
|
after(:build) do |sm|
|
||||||
|
FactoryGirl.create(:location, status_message: sm)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
factory(:status_message_with_photo) do
|
factory(:status_message_with_photo) do
|
||||||
sequence(:text) {|n| "There are #{n} ninjas in this photo." }
|
sequence(:text) {|n| "There are #{n} ninjas in this photo." }
|
||||||
after(:build) do |sm|
|
after(:build) do |sm|
|
||||||
|
|
@ -134,6 +140,7 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
|
|
||||||
factory(:location) do
|
factory(:location) do
|
||||||
|
address "unicorn city"
|
||||||
lat 1
|
lat 1
|
||||||
lng 2
|
lng 2
|
||||||
end
|
end
|
||||||
|
|
|
||||||
27
spec/integration/mobile_posts_spec.rb
Normal file
27
spec/integration/mobile_posts_spec.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe PostsController, type: :request do
|
||||||
|
context "with a poll" do
|
||||||
|
let(:sm) { FactoryGirl.build(:status_message_with_poll, public: true) }
|
||||||
|
|
||||||
|
it "displays the poll" do
|
||||||
|
get "/posts/#{sm.id}", format: :mobile
|
||||||
|
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
expect(response.body).to match(/div class='poll'/)
|
||||||
|
expect(response.body).to match(/#{sm.poll.poll_answers.first.answer}/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a location" do
|
||||||
|
let(:sm) { FactoryGirl.build(:status_message_with_location, public: true) }
|
||||||
|
|
||||||
|
it "displays the location" do
|
||||||
|
get "/posts/#{sm.id}", format: :mobile
|
||||||
|
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
expect(response.body).to match(/div class='location'/)
|
||||||
|
expect(response.body).to match(/#{I18n.t("posts.show.location", location: sm.location.address)}/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue