Skip to content

mocha tests and update dependencies #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/public/assets
.env
node_modules
npm-debug.log
npm-debug.log*
/coverage

# Ignore bundle dependencies
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.7
5.0
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.2
2.2.3
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language:
- ruby
rvm:
- 2.2.2
- 2.2.3
install:
- bundle install
- npm install -g npm
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source "https://rubygems.org"
ruby "2.2.2"
ruby "2.2.3"

#
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
Expand Down
16 changes: 7 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GEM
ast (2.1.0)
astrolabe (1.3.1)
parser (~> 2.2)
autoprefixer-rails (6.0.3)
autoprefixer-rails (6.1.0.1)
execjs
json
awesome_print (1.6.1)
Expand All @@ -68,8 +68,7 @@ GEM
bundler-audit (0.4.0)
bundler (~> 1.2)
thor (~> 0.18)
byebug (5.0.0)
columnize (= 0.9.0)
byebug (8.0.0)
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
Expand All @@ -92,7 +91,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
columnize (0.9.0)
connection_pool (2.2.0)
coveralls (0.8.3)
json (~> 1.8)
Expand Down Expand Up @@ -155,8 +153,8 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.2.0)
byebug (~> 5.0)
pry-byebug (3.3.0)
byebug (~> 8.0)
pry (~> 0.10)
pry-doc (0.8.0)
pry (~> 0.9)
Expand Down Expand Up @@ -205,10 +203,10 @@ GEM
raindrops (0.15.0)
rake (10.4.2)
rdoc (4.2.0)
react_on_rails (1.0.0.pre)
react_on_rails (1.0.1)
connection_pool
execjs (~> 2.5)
rails (>= 4.0)
rails (>= 3.2)
ref (2.0.0)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
Expand Down Expand Up @@ -307,7 +305,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unicorn (4.9.0)
unicorn (5.0.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ module.exports = {
// And update this
styleLoader: 'style-loader!css-loader!sass-loader?imagePath=/assets/images&includePaths[]=' + bourbonPaths,
```
- `@import 'bourbon';` Import bourbon from your [scss file](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/client/assets/stylesheets/_app-styling-post-bootstrap-loading.scss)
- `@import 'bourbon';` Import bourbon from your [scss file](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/client/assets/stylesheets/_app-styling-post-bootstrap-loading.scss)

# Notes on Rails assets
## Rails Asset Pipeline Magic
Expand Down Expand Up @@ -266,11 +266,31 @@ git push heroku master
```

# Running Tests
*Default rake task runs tests and linting*
*Default rake task runs feature specs, mocha tests and linting*

We have feature tests in /spec/features
We have;

* feature tests in /spec/features
* component unit tests in /client/test/
* javascript linting

From the root of the project, you can run all specs+tests+linter with

npm run test

Run the feature specs individually with `rspec`.

Run the React unit tests (all .js and .jsx files) from the `client` dir with;

cd client
npm run test --silent

In lieu of having `mocha --watch` working properly (pull request welcome!), you can have your js tests continually running with `watch`

npm install -g watch
cd client
watch 'npm run test --silent' test/ app/

Run the tests with `rspec`.

## CI configuration
Add those lines to your CI scripts after `bundle install`
Expand Down
5 changes: 4 additions & 1 deletion app/views/pages/simple.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<h2>Using React (no Flux framework) + Rails Backend (with react_on_rails gem)</h2>
<h2>Using React (no Flux framework) + Rails Backend (with
<a href="https://github.com/shakacode/react_on_rails">react_on_rails gem</a>)</h2>
<p>This example is much simpler than the one using React + Redux and is appropriate when:</p>
<ul>
<li>No or minimal MVC</li>
<li>No async necessary</li>
<li>No server rendering</li>
<li>No pre-population of props</li>
</ul>
<hr/>

Expand Down
1 change: 1 addition & 0 deletions client/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins:
env:
browser: true
node: true
mocha: true

rules:
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Comment extends React.Component {
<h2 className="comment-author">
{author}
</h2>
<span dangerouslySetInnerHTML={{__html: rawMarkup}}/>
<span dangerouslySetInnerHTML={{__html: rawMarkup}} className="comment-text"/>
</div>
);
}
Expand Down
Loading