Skip to content

Commit

Permalink
Got tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Jul 19, 2016
1 parent ef12ca4 commit 828be42
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Provider } from 'react-redux';

import NonRouterCommentsContainer from '../containers/NonRouterCommentsContainer';

export default (_props, _railsContext) => {
Expand Down
1 change: 1 addition & 0 deletions client/app/bundles/comments/startup/ClientRouterApp.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Compare to ../ServerRouterApp.jsx
import React from 'react';
import { Provider } from 'react-redux';
import ReactOnRails from 'react-on-rails';
Expand Down
14 changes: 0 additions & 14 deletions client/app/bundles/comments/startup/ServerApp.jsx

This file was deleted.

1 change: 1 addition & 0 deletions client/app/bundles/comments/startup/ServerRouterApp.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Compare to ../ClientRouterApp.jsx
import React from 'react';
import { Provider } from 'react-redux';
import { match, RouterContext } from 'react-router';
Expand Down
2 changes: 1 addition & 1 deletion client/app/bundles/comments/startup/clientRegistration.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import App from './ClientApp';
import App from './App';
import RouterApp from './ClientRouterApp';
import SimpleCommentScreen from '../components/SimpleCommentScreen/SimpleCommentScreen';
import routerCommentsStore from '../store/routerCommentsStore';
Expand Down
2 changes: 1 addition & 1 deletion client/app/bundles/comments/startup/serverRegistration.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Example of React + Redux
import App from './ServerApp';
import App from './App';
import RouterApp from './ServerRouterApp';
import SimpleCommentScreen from '../components/SimpleCommentScreen/SimpleCommentScreen';
import ReactOnRails from 'react-on-rails';
Expand Down
20 changes: 10 additions & 10 deletions spec/features/add_new_comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@
feature "Add new comment" do
context "React Router", page: :main, js: true do
context "via Horizontal Form", form: :horizontal do
include_examples "New Comment Submission"
include_examples "New Comment Submission", true
end
context "via Inline Form", form: :inline do
include_examples "New Comment Submission"
include_examples "New Comment Submission", true
end
context "via Stacked Form", form: :stacked do
include_examples "New Comment Submission"
include_examples "New Comment Submission", true
end
end

context "React/Redux", page: :react_demo, js: true do
context "via Horizontal Form", form: :horizontal do
include_examples "New Comment Submission"
include_examples "New Comment Submission", true
end
context "via Inline Form", form: :inline do
include_examples "New Comment Submission"
include_examples "New Comment Submission", true
end
context "via Stacked Form", form: :stacked do
include_examples "New Comment Submission"
include_examples "New Comment Submission", true
end
end

context "simple page", page: :simple, js: true do
context "via Horizontal Form", form: :horizontal do
include_examples "New Comment Submission"
include_examples "New Comment Submission", false
end
context "via Inline Form", form: :inline do
include_examples "New Comment Submission"
include_examples "New Comment Submission", false
end
context "via the Stacked Form", form: :stacked, driver: js_selenium_driver do
include_examples "New Comment Submission"
include_examples "New Comment Submission", false
end
end

context "from classic page", page: :classic do
background { click_link "New Comment" }
include_examples "New Comment Submission"
include_examples "New Comment Submission", false
end
end
14 changes: 9 additions & 5 deletions spec/features/shared/examples.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"
require "features/shared/contexts"

shared_examples "New Comment Submission" do
shared_examples "New Comment Submission" do |expect_comment_count|
context "when the new comment is submitted" do
let(:name) { "John Smith" }
let(:text) { "Hello there!" }
Expand All @@ -10,8 +10,10 @@
scenario "comment is added" do
expect(page).to have_css(".js-comment-author", text: name)
expect(page).to have_css(".js-comment-text", text: text)
expect(page).to have_css("#js-comment-count",
text: "Comments: #{Comment.count}")
if expect_comment_count
expect(page).to have_css("#js-comment-count",
text: "Comments: #{Comment.count}")
end
end
end

Expand All @@ -20,8 +22,10 @@

scenario "comment is not added" do
expect(page).to have_selector(".comment", count: comments_count)
expect(page).to have_css("#js-comment-count",
text: "Comments: #{Comment.count}")
if expect_comment_count
expect(page).to have_css("#js-comment-count",
text: "Comments: #{Comment.count}")
end
end
end

Expand Down

0 comments on commit 828be42

Please sign in to comment.